1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-08 23:15:24 +02:00

Merge pull request #165 from karan0handa/fix-session-load

Fix session load
This commit is contained in:
Josh Pigford 2024-01-20 11:02:06 -06:00 committed by GitHub
commit 77e7e3dc2b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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