diff options
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) +    }) +}   |