Typefix
parent
8b07b839e9
commit
b9f90144c5
|
@ -83,7 +83,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||||
// get user's credentials + their connected integrations
|
// get user's credentials + their connected integrations
|
||||||
const calendarCredentials = getCalendarCredentials(user.credentials);
|
const calendarCredentials = getCalendarCredentials(user.credentials);
|
||||||
// get all the connected integrations' calendars (from third party)
|
// get all the connected integrations' calendars (from third party)
|
||||||
const connectedCalendars = await getConnectedCalendars(calendarCredentials, user.selectedCalendars);
|
const { connectedCalendars } = await getConnectedCalendars(calendarCredentials, user.selectedCalendars);
|
||||||
const calendars = connectedCalendars.flatMap((c) => c.calendars).filter(notEmpty);
|
const calendars = connectedCalendars.flatMap((c) => c.calendars).filter(notEmpty);
|
||||||
const selectableCalendars = calendars.map((cal) => {
|
const selectableCalendars = calendars.map((cal) => {
|
||||||
return { selected: selectedCalendarIds.findIndex((s) => s.externalId === cal.externalId) > -1, ...cal };
|
return { selected: selectedCalendarIds.findIndex((s) => s.externalId === cal.externalId) > -1, ...cal };
|
||||||
|
|
|
@ -395,7 +395,7 @@ const loggedInViewerRouter = router({
|
||||||
const { user } = ctx;
|
const { user } = ctx;
|
||||||
const { integration, externalId, eventTypeId } = input;
|
const { integration, externalId, eventTypeId } = input;
|
||||||
const calendarCredentials = getCalendarCredentials(user.credentials);
|
const calendarCredentials = getCalendarCredentials(user.credentials);
|
||||||
const connectedCalendars = await getConnectedCalendars(calendarCredentials, user.selectedCalendars);
|
const { connectedCalendars } = await getConnectedCalendars(calendarCredentials, user.selectedCalendars);
|
||||||
const allCals = connectedCalendars.map((cal) => cal.calendars ?? []).flat();
|
const allCals = connectedCalendars.map((cal) => cal.calendars ?? []).flat();
|
||||||
|
|
||||||
const credentialId = allCals.find(
|
const credentialId = allCals.find(
|
||||||
|
|
Loading…
Reference in New Issue