diff --git a/frontend/src/hooks/useAuth.ts b/frontend/src/hooks/useAuth.ts index 4861cd3e..495cf91e 100755 --- a/frontend/src/hooks/useAuth.ts +++ b/frontend/src/hooks/useAuth.ts @@ -32,14 +32,12 @@ export const useAuth = () => { export const useLogoutRedirection = () => { const router = useRouter(); - const isDynamicPath = router.pathname.includes("["); const hasPublicPath = PUBLIC_PATHS.includes(router.pathname); - const encodedPath = isDynamicPath - ? encodeURIComponent("/settings") - : encodeURIComponent(router.pathname); const logoutRedirection = async (fullReload: boolean = false) => { if (!hasPublicPath) { - const redirectUrl = `/${RouterType.LOGIN}?redirect=${encodedPath}`; + const redirectUrl = `/${RouterType.LOGIN}?redirect=${encodeURIComponent( + router.asPath, + )}`; if (fullReload) { window.location.replace(redirectUrl);