diff --git a/apps/web/components/eventtype/EventAdvancedTab.tsx b/apps/web/components/eventtype/EventAdvancedTab.tsx index ea276898bc..b33098f128 100644 --- a/apps/web/components/eventtype/EventAdvancedTab.tsx +++ b/apps/web/components/eventtype/EventAdvancedTab.tsx @@ -73,16 +73,18 @@ export const EventAdvancedTab = ({ eventType, team }: Pick { const bookingFields = formMethods.getValues("bookingFields"); - const newBookingFieldsWithGuestsDisabled = bookingFields.map((field) => { - if (field.name === "guests") { - return { - ...field, - hidden: !enabled, - }; - } - return field; - }); - formMethods.setValue("bookingFields", newBookingFieldsWithGuestsDisabled); + formMethods.setValue( + "bookingFields", + bookingFields.map((field) => { + if (field.name === "guests") { + return { + ...field, + hidden: !enabled, + }; + } + return field; + }) + ); }; return (
diff --git a/apps/web/pages/api/book/event.ts b/apps/web/pages/api/book/event.ts index 3cd3393597..b3ec5029fb 100644 --- a/apps/web/pages/api/book/event.ts +++ b/apps/web/pages/api/book/event.ts @@ -8,7 +8,9 @@ async function handler(req: NextApiRequest & { userId?: number }) { const session = await getSession({ req }); /* To mimic API behavior and comply with types */ req.userId = session?.user?.id || -1; - const booking = await handleNewBooking(req, true); + const booking = await handleNewBooking(req, { + isNotAnApiCall: true, + }); return booking; } diff --git a/packages/features/bookings/lib/handleNewBooking.ts b/packages/features/bookings/lib/handleNewBooking.ts index 9c0efa1e86..ebd997f036 100644 --- a/packages/features/bookings/lib/handleNewBooking.ts +++ b/packages/features/bookings/lib/handleNewBooking.ts @@ -398,7 +398,14 @@ function getCustomInputsResponses( return customInputsResponses; } -async function handler(req: NextApiRequest & { userId?: number | undefined }, isNotAnApiCall = false) { +async function handler( + req: NextApiRequest & { userId?: number | undefined }, + { + isNotAnApiCall = false, + }: { + isNotAnApiCall?: boolean; + } +) { const { userId } = req; // handle dynamic user