diff options
author | 2020-10-05 13:04:46 +0100 | |
---|---|---|
committer | 2020-10-05 13:04:46 +0100 | |
commit | 8b28e0ea36ee7613254817d89a2ed33050137ad0 (patch) | |
tree | 11ca8fd09a175066d936fe3a389a53d51bb5fb9c /src | |
parent | Update the form path (diff) |
Update the forms API wrapper to fetch a specific form
Diffstat (limited to 'src')
-rw-r--r-- | src/api/forms.ts | 32 |
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) + }) +} |