Improve admin form workspace UX
This commit is contained in:
@@ -22,15 +22,18 @@ export async function createQuestion(
|
||||
}
|
||||
) {
|
||||
await requireAdmin();
|
||||
await db.insert(questions).values({
|
||||
formId,
|
||||
type: data.type,
|
||||
label: sanitizeHtml(data.label),
|
||||
required: data.required,
|
||||
displayOrder: data.displayOrder,
|
||||
options: data.options ?? [],
|
||||
allowOther: false,
|
||||
});
|
||||
const [question] = await db
|
||||
.insert(questions)
|
||||
.values({
|
||||
formId,
|
||||
type: data.type,
|
||||
label: sanitizeHtml(data.label),
|
||||
required: data.required,
|
||||
displayOrder: data.displayOrder,
|
||||
options: data.options ?? [],
|
||||
allowOther: false,
|
||||
})
|
||||
.returning();
|
||||
void sse.forms.pub("update", {
|
||||
formId,
|
||||
entity: "question",
|
||||
@@ -38,6 +41,7 @@ export async function createQuestion(
|
||||
});
|
||||
revalidatePath("/form");
|
||||
revalidatePath("/admin/form");
|
||||
return question;
|
||||
}
|
||||
|
||||
export async function updateQuestion(
|
||||
|
||||
Reference in New Issue
Block a user