mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
@@ -1,10 +1,18 @@
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import { useAuth } from '@/contexts/AuthContext'
|
||||
|
||||
const DASHBOARD_BY_ROLE = {
|
||||
admin: '/admin',
|
||||
user: '/dashboard',
|
||||
staff: '/staff',
|
||||
}
|
||||
|
||||
export default function NotFound() {
|
||||
const navigate = useNavigate()
|
||||
const { user } = useAuth()
|
||||
|
||||
const goHome = () => {
|
||||
navigate(-1)
|
||||
navigate(DASHBOARD_BY_ROLE[user?.acc_type] ?? '/')
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,10 +1,18 @@
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import { useAuth } from '@/contexts/AuthContext'
|
||||
|
||||
const DASHBOARD_BY_ROLE = {
|
||||
admin: '/admin',
|
||||
user: '/dashboard',
|
||||
staff: '/staff',
|
||||
}
|
||||
|
||||
export default function Unauthorized() {
|
||||
const navigate = useNavigate()
|
||||
const { user } = useAuth()
|
||||
|
||||
const goHome = () => {
|
||||
navigate(-1)
|
||||
navigate(DASHBOARD_BY_ROLE[user?.acc_type] ?? '/')
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user