import { createBrowserRouter, IndexRouteObject, NonIndexRouteObject } from "react-router-dom"; import MainPage from "../app/main/page"; import ErrorPage from "../app/error"; import LayoutPage from "../app/layout"; import LoginPage from "../app/login"; import DepartmentAdminPage from "../app/admin/department/page"; import RoleAdminPage from "../app/admin/role/page"; import StaffAdminPage from "../app/admin/staff/page"; import TermAdminPage from "../app/admin/term/page"; import WithAuth from "../components/utilities/with-auth"; interface CustomIndexRouteObject extends IndexRouteObject { name?: string; breadcrumb?: string; } interface CustomNonIndexRouteObject extends NonIndexRouteObject { name?: string; children?: CustomRouteObject[]; breadcrumb?: string; } type CustomRouteObject = CustomIndexRouteObject | CustomNonIndexRouteObject; export const routes = [ { path: "/", element: , errorElement: , children: [ { index: true, element: }, { path: "admin", children: [ { path: "department", breadcrumb: "单位管理", element: ( ), }, { path: "staff", breadcrumb: "人员管理", element: ( ), }, { path: "term", breadcrumb: "术语管理", element: ( ), }, { path: "role", breadcrumb: "角色管理", element: ( ), } ], }, ], }, { path: '/login', element: } ] export const router = createBrowserRouter(routes);