aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Joe Banks <[email protected]>2025-08-08 23:26:27 +0100
committerGravatar Joe Banks <[email protected]>2025-08-08 23:26:27 +0100
commitfc8c3bbc73e50fbac3aab751130786e60fa9950f (patch)
tree9cbe68b64356a4f91873982f63b208cc7cdc0fe3
parentAdd @emotion/styled (diff)
Update getForm to return form with ancillary data
-rw-r--r--src/api/forms.ts16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/api/forms.ts b/src/api/forms.ts
index 77fbb8e..0721dcf 100644
--- a/src/api/forms.ts
+++ b/src/api/forms.ts
@@ -20,6 +20,20 @@ export interface Form {
submitted_text: string | null
}
+export interface Precheck {
+ severity: "warning" | "danger" | "secondary",
+ message: string
+}
+
+export interface SubmissionPrecheck {
+ can_submit: boolean,
+ problems: Array<Precheck>
+}
+
+export interface FormWithAncillaryData extends Form {
+ submission_precheck: SubmissionPrecheck
+}
+
export interface WebHook {
url: string,
message: string | null
@@ -30,7 +44,7 @@ export async function getForms(): Promise<Form[]> {
return fetch_response.data;
}
-export async function getForm(id: string): Promise<Form> {
+export async function getForm(id: string): Promise<FormWithAncillaryData> {
const fetch_response = await ApiClient.get(`forms/${id}`);
return fetch_response.data;
}