diff options
| author | 2020-12-14 10:50:43 +0200 | |
|---|---|---|
| committer | 2020-12-14 10:50:43 +0200 | |
| commit | 8e2b2764b136b9e742f75f7b4a3621cb56238bc6 (patch) | |
| tree | af9f101262f240e3f94fc9069ca6b9a868e66588 /src | |
| parent | Move loading to different component (diff) | |
Update getForms function to fetch data from API
Diffstat (limited to 'src')
| -rw-r--r-- | src/api/forms.ts | 25 | 
1 files changed, 4 insertions, 21 deletions
| diff --git a/src/api/forms.ts b/src/api/forms.ts index c20a587..724d6b7 100644 --- a/src/api/forms.ts +++ b/src/api/forms.ts @@ -1,4 +1,5 @@  import { Question, QuestionType } from "./question" +import ApiClient from "./client";  export enum FormFeatures {      Discoverable = "DISCOVERABLE", @@ -16,27 +17,9 @@ export interface Form {      description: string  } -export function getForms(): Form[] { -    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 async function getForms(): Promise<Form[]> { +    const resp = await ApiClient.get("forms/discoverable"); +    return resp.data;  }  export function getForm(id: string): Promise<Form> { | 
