From 715d88ba3cbb275c552ee088da7198db3d51ecc4 Mon Sep 17 00:00:00 2001 From: Anthony LC Date: Wed, 10 Dec 2025 22:36:31 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F(frontend)=20replace=20auth?= =?UTF-8?q?=20redirect=20logic=20for=20home?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To be intercepted by ingress redirects, we need to redirect using window.location instead of using Next.js router. The Next.js router does not trigger a full page reload, so the ingress redirect logic is not executed. --- .../apps/impress/src/features/auth/components/Auth.tsx | 2 +- src/frontend/apps/impress/src/features/auth/conf.ts | 2 +- src/frontend/apps/impress/src/pages/login/index.tsx | 5 +---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/frontend/apps/impress/src/features/auth/components/Auth.tsx b/src/frontend/apps/impress/src/features/auth/components/Auth.tsx index 414ac51b..ea079d1f 100644 --- a/src/frontend/apps/impress/src/features/auth/components/Auth.tsx +++ b/src/frontend/apps/impress/src/features/auth/components/Auth.tsx @@ -44,7 +44,7 @@ export const Auth = ({ children }: PropsWithChildren) => { if (config?.FRONTEND_HOMEPAGE_FEATURE_ENABLED) { if (pathname !== HOME_URL) { setIsRedirecting(true); - void replace(HOME_URL).then(() => setIsRedirecting(false)); + window.location.replace(HOME_URL); } return; diff --git a/src/frontend/apps/impress/src/features/auth/conf.ts b/src/frontend/apps/impress/src/features/auth/conf.ts index c44fe018..4e58db0f 100644 --- a/src/frontend/apps/impress/src/features/auth/conf.ts +++ b/src/frontend/apps/impress/src/features/auth/conf.ts @@ -1,6 +1,6 @@ import { baseApiUrl } from '@/api'; -export const HOME_URL = '/home'; +export const HOME_URL = '/home/'; export const LOGIN_URL = `${baseApiUrl()}authenticate/`; export const LOGOUT_URL = `${baseApiUrl()}logout/`; export const PATH_AUTH_LOCAL_STORAGE = 'docs-path-auth'; diff --git a/src/frontend/apps/impress/src/pages/login/index.tsx b/src/frontend/apps/impress/src/pages/login/index.tsx index f76bb896..2e06f826 100644 --- a/src/frontend/apps/impress/src/pages/login/index.tsx +++ b/src/frontend/apps/impress/src/pages/login/index.tsx @@ -1,10 +1,7 @@ -import { useRouter } from 'next/router'; - import { HOME_URL } from '@/features/auth'; const Page = () => { - const { replace } = useRouter(); - void replace(HOME_URL); + window.location.replace(HOME_URL); }; export default Page;