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 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 (
<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 });
/* 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;
}

View File

@ -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