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 2cf007e5..addb481b 100644 --- a/src/frontend/apps/impress/src/features/auth/components/Auth.tsx +++ b/src/frontend/apps/impress/src/features/auth/components/Auth.tsx @@ -5,6 +5,7 @@ import { PropsWithChildren } from 'react'; import { Box } from '@/components'; import { useConfig } from '@/core'; +import { HOME_URL } from '../conf'; import { useAuth } from '../hooks'; import { getAuthUrl, gotoLogin } from '../utils'; @@ -43,7 +44,7 @@ export const Auth = ({ children }: PropsWithChildren) => { */ if (!authenticated && !pathAllowed) { if (config?.FRONTEND_HOMEPAGE_FEATURE_ENABLED) { - void replace('/home'); + void replace(HOME_URL); } else { gotoLogin(); } @@ -57,7 +58,7 @@ export const Auth = ({ children }: PropsWithChildren) => { /** * If the user is authenticated and the path is the home page, we redirect to the index. */ - if (pathname === '/home' && authenticated) { + if (pathname === HOME_URL && authenticated) { void replace('/'); return ( diff --git a/src/frontend/apps/impress/src/features/auth/conf.ts b/src/frontend/apps/impress/src/features/auth/conf.ts index b8e59cf5..c44fe018 100644 --- a/src/frontend/apps/impress/src/features/auth/conf.ts +++ b/src/frontend/apps/impress/src/features/auth/conf.ts @@ -1,5 +1,6 @@ import { baseApiUrl } from '@/api'; -export const PATH_AUTH_LOCAL_STORAGE = 'docs-path-auth'; +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/features/auth/index.ts b/src/frontend/apps/impress/src/features/auth/index.ts index ec8b4043..c044307f 100644 --- a/src/frontend/apps/impress/src/features/auth/index.ts +++ b/src/frontend/apps/impress/src/features/auth/index.ts @@ -1,4 +1,5 @@ export * from './api'; export * from './components'; +export * from './conf'; export * from './hooks'; export * from './utils'; diff --git a/src/frontend/apps/impress/src/pages/login/index.tsx b/src/frontend/apps/impress/src/pages/login/index.tsx index dca21233..f76bb896 100644 --- a/src/frontend/apps/impress/src/pages/login/index.tsx +++ b/src/frontend/apps/impress/src/pages/login/index.tsx @@ -1,8 +1,10 @@ -import { HomeContent } from '@/features/home'; -import { NextPageWithLayout } from '@/types/next'; +import { useRouter } from 'next/router'; -const Page: NextPageWithLayout = () => { - return ; +import { HOME_URL } from '@/features/auth'; + +const Page = () => { + const { replace } = useRouter(); + void replace(HOME_URL); }; export default Page;