wip
This commit is contained in:
parent
313f1def49
commit
36f5eef849
12 changed files with 39 additions and 23 deletions
|
@ -1,13 +1,17 @@
|
|||
import { useUser } from '../../user/userStore.ts'
|
||||
import { useNavigate, Outlet } from 'react-router-dom'
|
||||
import { useEffect } from 'react'
|
||||
|
||||
export default function Protected() {
|
||||
const [user] = useUser()
|
||||
const { user } = useUser()
|
||||
|
||||
const navigate = useNavigate()
|
||||
if (!user) {
|
||||
navigate('/login')
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (!user) {
|
||||
navigate('/login')
|
||||
}
|
||||
}, [user, navigate])
|
||||
|
||||
return <Outlet />
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue