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:
parent
f2a5eb1495
commit
96059ad2f7
1 changed files with 2 additions and 4 deletions
|
@ -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')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue