Fixing event type duration query param (#6146)
* Fixing event type duration query param
* Ignoring query param instead of erroring out
* Removing unneeded string
* Amended useEffect for simplication
* Refactored useRouterQuery into new useTypedQuery
* Revert "Refactored useRouterQuery into new useTypedQuery"
This reverts commit b3b0aa6077
.
Co-authored-by: Alex van Andel <me@alexvanandel.com>
pull/6121/head^2
parent
9c40f76184
commit
ed02c10f54
|
@ -44,18 +44,17 @@ const BookingDescription: FC<Props> = (props) => {
|
|||
const { profile, eventType, isBookingPage = false, children } = props;
|
||||
const { date: bookingDate } = useRouterQuery("date");
|
||||
const { t } = useLocale();
|
||||
const { duration, setQuery: setDuration } = useRouterQuery("duration");
|
||||
const { duration = eventType.length.toString(), setQuery: setDuration } = useRouterQuery("duration");
|
||||
|
||||
useEffect(() => {
|
||||
if (eventType.metadata?.multipleDuration !== undefined) {
|
||||
if (!duration) {
|
||||
setDuration(eventType.length);
|
||||
} else {
|
||||
if (!eventType.metadata?.multipleDuration.includes(Number(duration))) {
|
||||
setDuration(eventType.length);
|
||||
}
|
||||
}
|
||||
if (
|
||||
eventType.metadata?.multipleDuration &&
|
||||
!eventType.metadata?.multipleDuration?.includes(Number(duration))
|
||||
) {
|
||||
setDuration(eventType.length.toString());
|
||||
}
|
||||
}, [setDuration, eventType.length, eventType.metadata?.multipleDuration, duration]);
|
||||
}, [duration, setDuration, eventType.length, eventType.metadata?.multipleDuration]);
|
||||
|
||||
let requiresConfirmation = eventType?.requiresConfirmation;
|
||||
let requiresConfirmationText = t("requires_confirmation");
|
||||
const rcThreshold = eventType?.metadata?.requiresConfirmationThreshold;
|
||||
|
|
Loading…
Reference in New Issue