feat: 添加路由守卫与拦截器
This commit is contained in:
40
src/router/routes.ts
Normal file
40
src/router/routes.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
/** @format */
|
||||
|
||||
import type { RouteObject } from "react-router-dom";
|
||||
|
||||
import NoFound from "@/views/404/404";
|
||||
import Login from "./modules/login/index.ts";
|
||||
import Register from "./modules/register/index.ts";
|
||||
import home from "./modules/home/index.ts";
|
||||
import Main from "./modules/main/index.ts";
|
||||
import ComponentLoading from "@/components/ComponentLoading";
|
||||
import Loading from "./modules/loading";
|
||||
|
||||
const routes: RouteObject[] = [
|
||||
{
|
||||
path: "/",
|
||||
Component: (props) => ComponentLoading(home, props),
|
||||
},
|
||||
{
|
||||
path: "/register",
|
||||
Component: (props) => ComponentLoading(Register, props),
|
||||
},
|
||||
{
|
||||
path: "/404",
|
||||
Component: (props) => ComponentLoading(NoFound, props),
|
||||
},
|
||||
{
|
||||
path: "/login",
|
||||
Component: (props) => ComponentLoading(Login, props),
|
||||
},
|
||||
{
|
||||
path: "/main",
|
||||
Component: (props) => ComponentLoading(Main, props),
|
||||
},
|
||||
{
|
||||
path: "/loading",
|
||||
Component: Loading,
|
||||
},
|
||||
];
|
||||
|
||||
export default routes;
|
Reference in New Issue
Block a user