diff --git a/src/features/authentication/components/AuthGuard.tsx b/src/features/authentication/components/AuthGuard.tsx index 154e684b..13f92c0a 100644 --- a/src/features/authentication/components/AuthGuard.tsx +++ b/src/features/authentication/components/AuthGuard.tsx @@ -6,12 +6,14 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import { ReactNode, useEffect } from 'react'; +import { ReactNode } from 'react'; import { useSessionContext } from '@/features/authentication/SessionContext.tsx'; import { SplashScreen } from '@/features/authentication/components/SplashScreen.tsx'; import { requestManager } from '@/lib/requests/RequestManager.ts'; import { AuthManager } from '@/features/authentication/AuthManager.ts'; +AuthManager.setAuthRequired(null); + export const AuthGuard = ({ children }: { children: ReactNode }) => { const { isAuthRequired } = useSessionContext(); @@ -28,15 +30,6 @@ export const AuthGuard = ({ children }: { children: ReactNode }) => { }, }); - useEffect(() => { - const handleUnload = () => { - AuthManager.setAuthRequired(null); - }; - - window.addEventListener('beforeunload', handleUnload); - return () => window.removeEventListener('beforeunload', handleUnload); - }, []); - if (isAuthRequired === null) { return ; }