初始化项目
This commit is contained in:
62
src/router/index.tsx
Normal file
62
src/router/index.tsx
Normal file
@@ -0,0 +1,62 @@
|
||||
import React from 'react';
|
||||
import { createBrowserRouter } from 'react-router-dom';
|
||||
import Layout from '../components/Layout';
|
||||
import ProtectedRoute from '../components/ProtectedRoute';
|
||||
import Login from '../pages/Login';
|
||||
import Home from '../pages/Home';
|
||||
import Devices from '../pages/Devices';
|
||||
import VideoControl from '../pages/Video';
|
||||
import Alerts from '../pages/Alerts';
|
||||
import Downloads from '../pages/Downloads';
|
||||
import Roles from '../pages/Roles';
|
||||
import Users from '../pages/Users';
|
||||
|
||||
export const router = createBrowserRouter([
|
||||
{
|
||||
path: '/login',
|
||||
element: <Login />,
|
||||
},
|
||||
{
|
||||
element: <ProtectedRoute />,
|
||||
children: [
|
||||
{
|
||||
path: '/',
|
||||
element: <Layout />,
|
||||
children: [
|
||||
{
|
||||
index: true,
|
||||
element: <Home />,
|
||||
},
|
||||
{
|
||||
path: 'devices',
|
||||
element: <Devices />,
|
||||
},
|
||||
{
|
||||
path: 'video',
|
||||
element: <VideoControl />,
|
||||
},
|
||||
{
|
||||
path: 'alerts',
|
||||
element: <Alerts />,
|
||||
},
|
||||
{
|
||||
path: 'downloads',
|
||||
element: <Downloads />,
|
||||
},
|
||||
{
|
||||
path: 'roles',
|
||||
element: <Roles />,
|
||||
},
|
||||
{
|
||||
path: 'users',
|
||||
element: <Users />,
|
||||
},
|
||||
{
|
||||
path: '*',
|
||||
element: <div className="p-10 text-center font-bold text-gray-400">模块开发中...</div>,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
Reference in New Issue
Block a user