From 8e9868db30ffee47ff6931ad63f75d1db33987ca Mon Sep 17 00:00:00 2001 From: nicolas Date: Mon, 14 Jun 2021 18:47:05 +0200 Subject: [PATCH] Properly concat results and properly handle zoom meeting uuids --- pages/api/book/[user].ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pages/api/book/[user].ts b/pages/api/book/[user].ts index 68479e24ad..31182d3e05 100644 --- a/pages/api/book/[user].ts +++ b/pages/api/book/[user].ts @@ -80,7 +80,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) }); let results = []; - let referencesToCreate = undefined; + let referencesToCreate = []; if (rescheduleUid) { // Reschedule event @@ -135,7 +135,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) ]); } else { // Schedule event - results.concat(await async.mapLimit(calendarCredentials, 5, async (credential) => { + results = results.concat(await async.mapLimit(calendarCredentials, 5, async (credential) => { const response = await createEvent(credential, appendLinksToEvents(evt)); return { type: credential.type, @@ -143,7 +143,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) }; })); - results.concat(await async.mapLimit(videoCredentials, 5, async (credential) => { + results = results.concat(await async.mapLimit(videoCredentials, 5, async (credential) => { const response = await createMeeting(credential, meeting); return { type: credential.type, @@ -154,7 +154,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) referencesToCreate = results.map((result => { return { type: result.type, - uid: result.response.id + uid: result.response.uuid ?? result.response.id }; })); }