From 876fc188d471c7e774ec7fc19e822393e98a13b3 Mon Sep 17 00:00:00 2001 From: Syed Ali Shahbaz <52925846+alishaz-polymath@users.noreply.github.com> Date: Fri, 19 Jan 2024 13:28:03 +0400 Subject: [PATCH] Make usernameList optional and remove return obj discrepancy (#13323) --- apps/api/pages/api/slots/_get.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/api/pages/api/slots/_get.ts b/apps/api/pages/api/slots/_get.ts index 61447e1751..4c2d209464 100644 --- a/apps/api/pages/api/slots/_get.ts +++ b/apps/api/pages/api/slots/_get.ts @@ -22,7 +22,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) { const { usernameList, ...rest } = req.query; let slugs = usernameList; if (!Array.isArray(usernameList)) { - slugs = usernameList ? [usernameList] : []; + slugs = usernameList ? [usernameList] : undefined; } const input = getScheduleSchema.parse({ usernameList: slugs, ...rest }); const timeZoneSupported = input.timeZone ? isSupportedTimeZone(input.timeZone) : false; @@ -40,7 +40,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) { ) : availableSlots; - return slotsInProvidedTimeZone; + return { slots: slotsInProvidedTimeZone }; // eslint-disable-next-line @typescript-eslint/no-explicit-any } catch (cause) { if (cause instanceof TRPCError) {