Data/Season: Fix bug in create_driver action (don't ensure "active")
This commit is contained in:
@ -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);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user