♻️(frontend) replace auth redirect logic for home
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.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user