diff --git a/pages/api/schedules/[id].ts b/pages/api/schedules/[id].ts index 59c78ea12b..9dbb75470a 100644 --- a/pages/api/schedules/[id].ts +++ b/pages/api/schedules/[id].ts @@ -16,6 +16,7 @@ export async function scheduleById( body = safeParseJSON(body); if (!body.success) { res.status(400).json({ message: body.message }); + return; } const safeBody = schemaSingleScheduleBodyParams.safeParse(body); diff --git a/pages/api/schedules/index.ts b/pages/api/schedules/index.ts index 86faad4181..10536f5cea 100644 --- a/pages/api/schedules/index.ts +++ b/pages/api/schedules/index.ts @@ -16,7 +16,7 @@ async function createOrlistAllSchedules( res: NextApiResponse ) { body = safeParseJSON(body); - if (!body.success) { + if (body.success !== undefined && !body.success) { res.status(400).json({ message: body.message }); return; }