diff --git a/apps/client/pages/_app.tsx b/apps/client/pages/_app.tsx index d1fb65c9..ae4d14db 100644 --- a/apps/client/pages/_app.tsx +++ b/apps/client/pages/_app.tsx @@ -33,14 +33,16 @@ Sentry.init({ // Providers and components only relevant to a logged-in user const WithAuth = function ({ children }: PropsWithChildren) { - const { data: session } = useSession() + const { data: session, status } = useSession() const router = useRouter() useEffect(() => { + if (status === 'loading') return + if (!session) { router.push('/login') } - }, [session, router]) + }, [session, status, router]) if (session) { return (