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:
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
|
// 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 (
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue