Fix bug in data/season create_driver action (don't ensure "active")

This commit is contained in:
2024-12-15 22:44:43 +01:00
parent 9db8a946ce
commit 58b5fa0773

View File

@ -46,7 +46,10 @@ export const actions = {
if (!locals.admin) return { unauthorized: true }; if (!locals.admin) return { unauthorized: true };
const data: FormData = form_data_clean(await request.formData()); 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); await locals.pb.collection("drivers").create(data);