58 lines
1.4 KiB
TypeScript
Executable File
58 lines
1.4 KiB
TypeScript
Executable File
import {
|
|
createBrowserRouter,
|
|
IndexRouteObject,
|
|
Link,
|
|
NonIndexRouteObject,
|
|
useParams,
|
|
} from "react-router-dom";
|
|
import ErrorPage from "../app/error";
|
|
import DeptSettingPage from "../app/admin/deptsettingpage/page";
|
|
import LoginPage from "../app/login";
|
|
import WithAuth from "../components/utils/with-auth";
|
|
import { CodeManageProvider } from "../app/admin/code-manage/CodeManageContext";
|
|
import CodeManageLayout from "../app/admin/code-manage/CodeManageLayout";
|
|
interface CustomIndexRouteObject extends IndexRouteObject {
|
|
name?: string;
|
|
breadcrumb?: string;
|
|
}
|
|
interface CustomIndexRouteObject extends IndexRouteObject {
|
|
name?: string;
|
|
breadcrumb?: string;
|
|
}
|
|
|
|
export interface CustomNonIndexRouteObject extends NonIndexRouteObject {
|
|
name?: string;
|
|
children?: CustomRouteObject[];
|
|
breadcrumb?: string;
|
|
handle?: {
|
|
crumb: (data?: any) => void;
|
|
};
|
|
}
|
|
export type CustomRouteObject =
|
|
| CustomIndexRouteObject
|
|
| CustomNonIndexRouteObject;
|
|
export const routes: CustomRouteObject[] = [
|
|
{
|
|
path: "/",
|
|
element: <DeptSettingPage></DeptSettingPage>,
|
|
errorElement: <ErrorPage />,
|
|
},
|
|
{
|
|
path: "/login",
|
|
breadcrumb: "登录",
|
|
element: <LoginPage></LoginPage>,
|
|
},
|
|
{
|
|
path: "/code-manage",
|
|
element: <>
|
|
<WithAuth>
|
|
<CodeManageProvider>
|
|
<CodeManageLayout></CodeManageLayout>
|
|
</CodeManageProvider>
|
|
</WithAuth>
|
|
</>
|
|
},
|
|
];
|
|
|
|
export const router = createBrowserRouter(routes);
|