From 30183a9dc53e783aa02e9eb58e0cb41e4bf6cf2a Mon Sep 17 00:00:00 2001 From: Joe Au-Yeung Date: Wed, 25 Oct 2023 14:10:32 -0400 Subject: [PATCH] Attach credentialId to location option --- apps/web/components/eventtype/EventSetupTab.tsx | 4 ++-- packages/app-store/server.ts | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/apps/web/components/eventtype/EventSetupTab.tsx b/apps/web/components/eventtype/EventSetupTab.tsx index 754f060868..aa2d430b91 100644 --- a/apps/web/components/eventtype/EventSetupTab.tsx +++ b/apps/web/components/eventtype/EventSetupTab.tsx @@ -298,7 +298,7 @@ export const EventSetupTab = ( !validLocations.find((location) => location.type === newLocationType); if (canAddLocation) { - updateLocationField(index, { type: newLocationType }); + updateLocationField(index, { type: newLocationType, credentialId: e.credentialId }); } else { updateLocationField(index, { type: field.type }); showToast(t("location_already_exists"), "warning"); @@ -382,7 +382,7 @@ export const EventSetupTab = ( !validLocations.find((location) => location.type === newLocationType); if (canAppendLocation) { - append({ type: newLocationType }); + append({ type: newLocationType, credentialId: e.credentialId }); setSelectedNewOption(e); } else { showToast(t("location_already_exists"), "warning"); diff --git a/packages/app-store/server.ts b/packages/app-store/server.ts index f88ec7597f..c0ebdfa68a 100644 --- a/packages/app-store/server.ts +++ b/packages/app-store/server.ts @@ -88,7 +88,13 @@ export async function getLocationGroupedOptions( teamName: credential.team?.name, }))) { const label = `${app.locationOption.label} ${teamName ? `(${teamName})` : ""}`; - const option = { ...app.locationOption, label, icon: app.logo, slug: app.slug }; + const option = { + ...app.locationOption, + label, + icon: app.logo, + slug: app.slug, + credentialId: app.credential.id, + }; if (apps[groupByCategory]) { apps[groupByCategory] = [...apps[groupByCategory], option]; } else {