mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-09 07:25:19 +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 type { AppProps } from 'next/app'
|
||||||
import { ErrorBoundary } from 'react-error-boundary'
|
import { ErrorBoundary } from 'react-error-boundary'
|
||||||
import { Analytics } from '@vercel/analytics/react'
|
import { Analytics } from '@vercel/analytics/react'
|
||||||
|
@ -34,12 +34,10 @@ 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, status } = useSession()
|
const { data: session, status } = useSession()
|
||||||
const [isLoading, setLoading] = useState(true)
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (status === 'loading') return // Wait until the session status is not 'loading'
|
if (status === 'loading') return
|
||||||
setLoading(false)
|
|
||||||
|
|
||||||
if (!session) {
|
if (!session) {
|
||||||
router.push('/login')
|
router.push('/login')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue