From 9e371ded908427921edebefb859c0fef1d75415a Mon Sep 17 00:00:00 2001 From: Somay Chauhan Date: Fri, 31 May 2024 20:36:11 +0530 Subject: [PATCH] add redirectUrl to /eventTypes page as well (#15274) * During signup, if the account already exists, we redirect the user to /event-types instead of onboarding. Adding this redirection logic to /event-types page as well to ensure the user is redirected to the correct redirectUrl. --- .../event-types/views/event-types-listing-view.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/apps/web/modules/event-types/views/event-types-listing-view.tsx b/apps/web/modules/event-types/views/event-types-listing-view.tsx index 3338f76e47..d7d4037a63 100644 --- a/apps/web/modules/event-types/views/event-types-listing-view.tsx +++ b/apps/web/modules/event-types/views/event-types-listing-view.tsx @@ -955,6 +955,7 @@ const EventTypesPage: React.FC & { const orgBranding = useOrgBranding(); const routerQuery = useRouterQuery(); const filters = getTeamsFiltersFromQuery(routerQuery); + const router = useRouter(); // TODO: Maybe useSuspenseQuery to focus on success case only? Remember that it would crash the page when there is an error in query. Also, it won't support skeleton const { data, status, error } = trpc.viewer.eventTypes.getByViewer.useQuery(filters && { filters }, { @@ -967,6 +968,13 @@ const EventTypesPage: React.FC & { if (searchParams?.get("openIntercom") === "true") { open(); } + /** + * During signup, if the account already exists, we redirect the user to /event-types instead of onboarding. + * Adding this redirection logic here as well to ensure the user is redirected to the correct redirectUrl. + */ + const redirectUrl = localStorage.getItem("onBoardingRedirect"); + localStorage.removeItem("onBoardingRedirect"); + redirectUrl && router.push(redirectUrl); // eslint-disable-next-line react-hooks/exhaustive-deps }, []);