Initial QuestionGraph library and documentation

This commit is contained in:
Peter Stockings
2026-09-13 12:59:36 +10:00
commit 0879a3e786
48 changed files with 7712 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
import type { QuestionnaireSaveHandler } from "../../lib";
export const saveDraft: QuestionnaireSaveHandler = async request => {
const response = await fetch("/api/claims/current/draft", {
method: "PATCH",
headers: {
"Content-Type": "application/json",
"If-Match": JSON.stringify(request.revision),
},
body: JSON.stringify(request),
});
// Reject failures so the renderer stays on the page and allows a retry.
if (!response.ok) throw new Error("Could not save your answers.");
// The server returns { revision: number }.
return response.json();
};