Init
This commit is contained in:
45
src/router/index.tsx
Normal file
45
src/router/index.tsx
Normal file
@@ -0,0 +1,45 @@
|
||||
import { createBrowserRouter, Navigate, RouteObject } from 'react-router-dom'
|
||||
import Login from '@/pages/Login.tsx'
|
||||
import Manager from '@/pages/Manager.tsx'
|
||||
import AuthRoute from '@/AuthRoute.tsx'
|
||||
|
||||
const routes: RouteObject[] = [
|
||||
{
|
||||
path: '/',
|
||||
element: <AuthRoute />,
|
||||
children: [
|
||||
{
|
||||
path: '/login',
|
||||
element: <Login />,
|
||||
children: [
|
||||
{
|
||||
id: 'login',
|
||||
path: '1',
|
||||
element: <Manager />
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '',
|
||||
element: <Manager />,
|
||||
children: [
|
||||
{
|
||||
id: 'manager',
|
||||
path: '1',
|
||||
element: <Login />
|
||||
}
|
||||
],
|
||||
handle: {
|
||||
auth: true
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '*',
|
||||
element: <Navigate to="/" replace />
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
const router = createBrowserRouter(routes)
|
||||
export default router
|
||||
Reference in New Issue
Block a user