mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-09 07:25:19 +02:00
Merge pull request #165 from karan0handa/fix-session-load
Fix session load
This commit is contained in:
commit
77e7e3dc2b
1 changed files with 4 additions and 2 deletions
|
@ -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 (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue