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

remove redundant state

This commit is contained in:
Karan Handa 2024-01-20 13:30:59 +05:30
parent f2a5eb1495
commit 96059ad2f7

View file

@ -1,4 +1,4 @@
import { useEffect, useState, type PropsWithChildren, type ReactElement } from 'react'
import { useEffect, type PropsWithChildren, type ReactElement } from 'react'
import type { AppProps } from 'next/app'
import { ErrorBoundary } from 'react-error-boundary'
import { Analytics } from '@vercel/analytics/react'
@ -34,12 +34,10 @@ Sentry.init({
// Providers and components only relevant to a logged-in user
const WithAuth = function ({ children }: PropsWithChildren) {
const { data: session, status } = useSession()
const [isLoading, setLoading] = useState(true)
const router = useRouter()
useEffect(() => {
if (status === 'loading') return // Wait until the session status is not 'loading'
setLoading(false)
if (status === 'loading') return
if (!session) {
router.push('/login')