aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar ks129 <[email protected]>2020-12-13 20:44:28 +0200
committerGravatar ks129 <[email protected]>2020-12-13 20:44:28 +0200
commit296ee9774e53d990f73bf7f56edc5ec351f0609f (patch)
tree8e779c1e3c6af507644d6471c10fe1645fb9a28e
parentUpdate question types and interface to match changes in backend (diff)
Update form interface and add features
-rw-r--r--src/api/forms.ts29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/api/forms.ts b/src/api/forms.ts
index a4a4981..c20a587 100644
--- a/src/api/forms.ts
+++ b/src/api/forms.ts
@@ -1,17 +1,22 @@
import { Question, QuestionType } from "./question"
-export interface AllFormsForm {
- title: string,
- id: string,
- description: string,
- open: boolean
+export enum FormFeatures {
+ Discoverable = "DISCOVERABLE",
+ RequiresLogin = "REQUIRES_LOGIN",
+ Open = "OPEN",
+ CollectEmail = "COLLECT_EMAIL",
+ DisableAntispam = "DISABLE_ANTISPAM"
}
-export interface Form extends AllFormsForm {
- questions: Array<Question>
+export interface Form {
+ id: string,
+ features: Array<FormFeatures>,
+ questions: Array<Question>,
+ name: string,
+ description: string
}
-export function getForms(): AllFormsForm[] {
+export function getForms(): Form[] {
return [
{
title: "Ban Appeals",
@@ -36,14 +41,16 @@ export function getForms(): AllFormsForm[] {
export function getForm(id: string): Promise<Form> {
const data: Form = {
- title: "Ban Appeals",
+ name: "Ban Appeals",
id: "ban-appeals",
description: "Appealing bans from the Discord server",
- open: true,
+ features: [FormFeatures.Discoverable, FormFeatures.Open],
questions: [
{
+ id: "how-spanish-are-you",
name: "How Spanish are you?",
- type: QuestionType.Text
+ type: QuestionType.ShortText,
+ data: {}
}
]
}