Skip to content

Scheduling infrastructure for absolutely everyone.

Make usernameList optional and remove return obj discrepancy (#13323)

Syed Ali Shahbaz876fc188d471
diff --git a/apps/api/pages/api/slots/_get.ts b/apps/api/pages/api/slots/_get.ts
index 61447e1751d..4c2d2094648 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) {