feat: 添加路由守卫与拦截器

This commit is contained in:
landaiqing
2024-05-28 02:07:05 +08:00
parent ce246ae2fe
commit cb9c827220
5 changed files with 82 additions and 10 deletions

40
src/router/routes.ts Normal file
View 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;