搭建用户体系

This commit is contained in:
2026-07-03 23:40:33 +08:00
parent 37a9f865ed
commit 2df19fcd02
40 changed files with 2622 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
import { createBrowserRouter, Navigate } from 'react-router-dom'
import { Layout } from './components/Layout'
import { AuthGuard } from './components/AuthGuard'
import { Login } from './pages/Login'
import { Dashboard } from './pages/Dashboard'
import { Users } from './pages/Users'
import { Profile } from './pages/Profile'
export const router = createBrowserRouter([
{ path: '/login', element: <Login /> },
{
path: '/',
element: <Layout />,
children: [
{ index: true, element: <Dashboard /> },
{
path: 'users',
element: (
<AuthGuard allowedRoles={['admin', 'system_admin']} requireAuth>
<Users />
</AuthGuard>
),
},
{
path: 'profile',
element: (
<AuthGuard requireAuth>
<Profile />
</AuthGuard>
),
},
],
},
{ path: '*', element: <Navigate to="/" replace /> },
])