Ignoring query param instead of erroring out

pull/6146/head
Leo Giovanetti 2022-12-21 12:40:16 -03:00
parent 04a7b404d2
commit f2ef6fbaf3
1 changed files with 7 additions and 7 deletions

View File

@ -110,11 +110,17 @@ const SlotPicker = ({
}) => {
const [selectedDate, setSelectedDate] = useState<Dayjs>();
const [browsingDate, setBrowsingDate] = useState<Dayjs>();
const { duration } = useRouterQuery("duration");
let { duration } = useRouterQuery("duration");
const { date, setQuery: setDate } = useRouterQuery("date");
const { month, setQuery: setMonth } = useRouterQuery("month");
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>();
useEffect(() => {
@ -263,12 +269,6 @@ const AvailabilityPage = ({ profile, eventType, ...restProps }: Props) => {
const shouldAlignCentrally = !isEmbed || shouldAlignCentrallyInEmbed;
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 [timeFormat, setTimeFormat] = useState<TimeFormat>(detectBrowserTimeFormat);