Hotfix/schedule (#174)

* Allows empty call

An authorized API call by a non-admin user with empty body will still fetch his data now

* Adds missing return
This commit is contained in:
Syed Ali Shahbaz
2022-10-07 15:33:04 +05:30
committed by GitHub
parent d68ce5e72f
commit f5d953ef1c
2 changed files with 2 additions and 1 deletions
+1
View File
@@ -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);
+1 -1
View File
@@ -16,7 +16,7 @@ async function createOrlistAllSchedules(
res: NextApiResponse<SchedulesResponse | ScheduleResponse>
) {
body = safeParseJSON(body);
if (!body.success) {
if (body.success !== undefined && !body.success) {
res.status(400).json({ message: body.message });
return;
}