aboutsummaryrefslogtreecommitdiffstats
path: root/src/api/forms.ts
diff options
context:
space:
mode:
authorGravatar Joe Banks <[email protected]>2020-10-05 13:13:51 +0100
committerGravatar GitHub <[email protected]>2020-10-05 13:13:51 +0100
commit91ef1e8d905e1ac68f6a3968f379d0675dfe6dcf (patch)
tree617e685d475acd15a7a6423d3a9b7826ee674f00 /src/api/forms.ts
parentMerge pull request #14 from python-discord/api/add-dummy-forms (diff)
parentUpdate header test to include custom titles (diff)
Merge pull request #15 from python-discord/forms/add-form-page
Add specific form page
Diffstat (limited to 'src/api/forms.ts')
-rw-r--r--src/api/forms.ts32
1 files changed, 30 insertions, 2 deletions
diff --git a/src/api/forms.ts b/src/api/forms.ts
index 7c2666a..a4a4981 100644
--- a/src/api/forms.ts
+++ b/src/api/forms.ts
@@ -1,25 +1,53 @@
-export interface Form {
+import { Question, QuestionType } from "./question"
+
+export interface AllFormsForm {
title: string,
+ id: string,
description: string,
open: boolean
}
-export function getForms(): Form[] {
+export interface Form extends AllFormsForm {
+ questions: Array<Question>
+}
+
+export function getForms(): AllFormsForm[] {
return [
{
title: "Ban Appeals",
+ id: "ban-appeals",
description: "Appealing bans from the Discord server",
open: true
},
{
title: "Insights 2020",
+ id: "insights-2020",
description: "Insights about the Python Discord community",
open: false
},
{
title: "Code Jam 2099 Sign Ups",
+ id: "code-jam-2099-sign-up",
description: "Signing up for Python Discord's millionth code jam!",
open: false
}
]
}
+
+export function getForm(id: string): Promise<Form> {
+ const data: Form = {
+ title: "Ban Appeals",
+ id: "ban-appeals",
+ description: "Appealing bans from the Discord server",
+ open: true,
+ questions: [
+ {
+ name: "How Spanish are you?",
+ type: QuestionType.Text
+ }
+ ]
+ }
+ return new Promise((resolve) => {
+ setTimeout(() => resolve(data), 1500)
+ })
+}