From 71a50d88119ade5d78f047bee484e921783a220f Mon Sep 17 00:00:00 2001 From: gakshita Date: Fri, 23 May 2025 15:08:49 +0530 Subject: [PATCH] fix: replaced next_path with app_slug --- web/core/lib/wrappers/authentication-wrapper.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/web/core/lib/wrappers/authentication-wrapper.tsx b/web/core/lib/wrappers/authentication-wrapper.tsx index 2866812488..0d3d28b83a 100644 --- a/web/core/lib/wrappers/authentication-wrapper.tsx +++ b/web/core/lib/wrappers/authentication-wrapper.tsx @@ -29,6 +29,7 @@ export const AuthenticationWrapper: FC = observer((props const router = useAppRouter(); const searchParams = useSearchParams(); const nextPath = searchParams.get("next_path"); + const appSlug = searchParams.get("app_slug"); // props const { children, pageType = EPageTypes.AUTHENTICATED } = props; // hooks @@ -42,6 +43,7 @@ export const AuthenticationWrapper: FC = observer((props shouldRetryOnError: false, }); + const pathnameWithAppSlug = appSlug ? `${pathname}?app_slug=${appSlug}` : pathname; const isUserOnboard = currentUserProfile?.is_onboarded || (currentUserProfile?.onboarding_step?.profile_complete && @@ -50,8 +52,6 @@ export const AuthenticationWrapper: FC = observer((props currentUserProfile?.onboarding_step?.workspace_join) || false; - const pathnameWithNextPath = pathname && nextPath ? `${pathname}?next_path=${nextPath}` : pathname; - const getWorkspaceRedirectionUrl = (): string => { let redirectionRoute = "/profile"; @@ -92,7 +92,7 @@ export const AuthenticationWrapper: FC = observer((props router.push(currentRedirectRoute); return <>; } else { - router.push(pathnameWithNextPath ? `/onboarding?next_path=${pathnameWithNextPath}` : `/onboarding`); + router.push("/onboarding"); return <>; } } @@ -100,7 +100,7 @@ export const AuthenticationWrapper: FC = observer((props if (pageType === EPageTypes.ONBOARDING) { if (!currentUser?.id) { - router.push(`/${pathnameWithNextPath ? `?next_path=${pathnameWithNextPath}` : ``}`); + router.push(`/${pathnameWithAppSlug ? `?next_path=${pathnameWithAppSlug}` : ``}`); return <>; } else { if (currentUser && currentUserProfile?.id && isUserOnboard) { @@ -113,7 +113,7 @@ export const AuthenticationWrapper: FC = observer((props if (pageType === EPageTypes.SET_PASSWORD) { if (!currentUser?.id) { - router.push(`/${pathnameWithNextPath ? `?next_path=${pathnameWithNextPath}` : ``}`); + router.push(`/${pathnameWithAppSlug ? `?next_path=${pathnameWithAppSlug}` : ``}`); return <>; } else { if (currentUser && !currentUser?.is_password_autoset && currentUserProfile?.id && isUserOnboard) { @@ -128,11 +128,11 @@ export const AuthenticationWrapper: FC = observer((props if (currentUser?.id) { if (currentUserProfile && currentUserProfile?.id && isUserOnboard) return <>{children}; else { - router.push(pathnameWithNextPath ? `/onboarding?next_path=${pathnameWithNextPath}` : `/onboarding`); + router.push(`/onboarding`); return <>; } } else { - router.push(`/${pathnameWithNextPath ? `?next_path=${pathnameWithNextPath}` : ``}`); + router.push(`/${pathnameWithAppSlug ? `?next_path=${pathnameWithAppSlug}` : ``}`); return <>; } }