Data/Season: Fix bug in create_driver action (don't ensure "active")

This commit is contained in:
2024-12-15 22:44:43 +01:00
parent 6d93ca7dab
commit 35c6f59d4b

View File

@ -46,7 +46,10 @@ export const actions = {
if (!locals.admin) return { unauthorized: true };
const data: FormData = form_data_clean(await request.formData());
form_data_ensure_keys(data, ["firstname", "lastname", "code", "team", "headshot", "active"]);
form_data_ensure_keys(data, ["firstname", "lastname", "code", "team", "headshot"]);
// The toggle switch will report "on" or nothing
data.set("active", data.has("active") ? "true" : "false");
await locals.pb.collection("drivers").create(data);