Ignoring query param instead of erroring out
parent
04a7b404d2
commit
f2ef6fbaf3
|
@ -110,11 +110,17 @@ const SlotPicker = ({
|
||||||
}) => {
|
}) => {
|
||||||
const [selectedDate, setSelectedDate] = useState<Dayjs>();
|
const [selectedDate, setSelectedDate] = useState<Dayjs>();
|
||||||
const [browsingDate, setBrowsingDate] = useState<Dayjs>();
|
const [browsingDate, setBrowsingDate] = useState<Dayjs>();
|
||||||
const { duration } = useRouterQuery("duration");
|
let { duration } = useRouterQuery("duration");
|
||||||
const { date, setQuery: setDate } = useRouterQuery("date");
|
const { date, setQuery: setDate } = useRouterQuery("date");
|
||||||
const { month, setQuery: setMonth } = useRouterQuery("month");
|
const { month, setQuery: setMonth } = useRouterQuery("month");
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
|
// Showing error if event type doesn't have multiple duration and duration query param exists
|
||||||
|
const metadata = EventTypeMetaDataSchema.parse(eventType.metadata);
|
||||||
|
if (!metadata?.multipleDuration && router.query.duration != undefined) {
|
||||||
|
duration = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
const [slotPickerRef] = useAutoAnimate<HTMLDivElement>();
|
const [slotPickerRef] = useAutoAnimate<HTMLDivElement>();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -263,12 +269,6 @@ const AvailabilityPage = ({ profile, eventType, ...restProps }: Props) => {
|
||||||
const shouldAlignCentrally = !isEmbed || shouldAlignCentrallyInEmbed;
|
const shouldAlignCentrally = !isEmbed || shouldAlignCentrallyInEmbed;
|
||||||
const isBackgroundTransparent = useIsBackgroundTransparent();
|
const isBackgroundTransparent = useIsBackgroundTransparent();
|
||||||
|
|
||||||
// Showing error if event type doesn't have multiple duration and duration query param exists
|
|
||||||
const metadata = EventTypeMetaDataSchema.parse(eventType.metadata);
|
|
||||||
if (!metadata?.multipleDuration && router.query.duration != undefined) {
|
|
||||||
router.replace(`/500?error=${encodeURIComponent(t("error_event_type_duration"))}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const [timeZone, setTimeZone] = useState<string>();
|
const [timeZone, setTimeZone] = useState<string>();
|
||||||
const [timeFormat, setTimeFormat] = useState<TimeFormat>(detectBrowserTimeFormat);
|
const [timeFormat, setTimeFormat] = useState<TimeFormat>(detectBrowserTimeFormat);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue