From 8b28e0ea36ee7613254817d89a2ed33050137ad0 Mon Sep 17 00:00:00 2001 From: Joe Banks Date: Mon, 5 Oct 2020 13:04:46 +0100 Subject: Update the forms API wrapper to fetch a specific form --- src/api/forms.ts | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'src/api') 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 +} + +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
{ + 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) + }) +} -- cgit v1.2.3