Feedback from zomars

pull/6560/head
Hariom Balhara 2023-02-11 12:57:40 +05:30
parent f45be560cb
commit 543b25f7df
3 changed files with 23 additions and 12 deletions

View File

@ -73,16 +73,18 @@ export const EventAdvancedTab = ({ eventType, team }: Pick<EventTypeSetupProps,
const toggleGuests = (enabled: boolean) => { const toggleGuests = (enabled: boolean) => {
const bookingFields = formMethods.getValues("bookingFields"); const bookingFields = formMethods.getValues("bookingFields");
const newBookingFieldsWithGuestsDisabled = bookingFields.map((field) => { formMethods.setValue(
if (field.name === "guests") { "bookingFields",
return { bookingFields.map((field) => {
...field, if (field.name === "guests") {
hidden: !enabled, return {
}; ...field,
} hidden: !enabled,
return field; };
}); }
formMethods.setValue("bookingFields", newBookingFieldsWithGuestsDisabled); return field;
})
);
}; };
return ( return (
<div className="flex flex-col space-y-8"> <div className="flex flex-col space-y-8">

View File

@ -8,7 +8,9 @@ async function handler(req: NextApiRequest & { userId?: number }) {
const session = await getSession({ req }); const session = await getSession({ req });
/* To mimic API behavior and comply with types */ /* To mimic API behavior and comply with types */
req.userId = session?.user?.id || -1; req.userId = session?.user?.id || -1;
const booking = await handleNewBooking(req, true); const booking = await handleNewBooking(req, {
isNotAnApiCall: true,
});
return booking; return booking;
} }

View File

@ -398,7 +398,14 @@ function getCustomInputsResponses(
return customInputsResponses; 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; const { userId } = req;
// handle dynamic user // handle dynamic user