diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 0958040030..81f6c744ec 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -2,6 +2,7 @@ import { CustomGlobalStyle } from '@components/CustomGlobalStyle' import { FrontendErrorBoundary } from '@components/FrontendErrorBoundary' import { useMatomo } from '@hooks/useMatomo' import { GlobalStyle, THEME, ThemeProvider } from '@mtes-mct/monitor-ui' +import { LandingPage } from '@pages/LandingPage' import { UnsupportedBrowserPage } from '@pages/UnsupportedBrowserPage' import { isBrowserSupported } from '@utils/isBrowserSupported' import { UserAccountContext } from 'context/UserAccountContext' @@ -11,12 +12,22 @@ import { RouterProvider } from 'react-router-dom' import { CustomProvider as RsuiteCustomProvider } from 'rsuite' import rsuiteFrFr from 'rsuite/locales/fr_FR' +import { useCustomAuth } from './auth/hooks/useCustomAuth' import { router } from './router' countries.registerLocale(COUNTRIES_FR) export function App() { useMatomo() + const { isAuthorized, isLoading, userAccount } = useCustomAuth() + + if (isLoading) { + return + } + + if (!isAuthorized || !userAccount) { + return + } if (!isBrowserSupported()) { return