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

This commit is contained in:
Syed Ali Shahbaz
2024-01-19 09:28:03 +00:00
committed by GitHub
parent d1810d9f14
commit 876fc188d4
+2 -2
View File
@@ -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) {