import { useAuth } from "react-oidc-context"; import { Navigate, Outlet, useLocation } from "react-router-dom"; export default function AuthGuard() { const auth = useAuth(); const location = useLocation(); const isTest = (window as Window & typeof globalThis & { _IS_TEST_MODE?: boolean }) ._IS_TEST_MODE === true; if (isTest) { return ; } if (auth.isLoading || auth.activeNavigator) { return
Loading...
; } if (auth.error) { return (

인증 오류

{auth.error.message}

); } if (!auth.isAuthenticated) { const returnTo = `${location.pathname}${location.search}${location.hash}`; return ( ); } return ; }