import {
createBrowserRouter,
IndexRouteObject,
Link,
NonIndexRouteObject,
} from "react-router-dom";
import { RolePerms } from "@nicestack/common";
import ErrorPage from "../app/error";
import DepartmentAdminPage from "../app/admin/department/page";
import TermAdminPage from "../app/admin/term/page";
import StaffAdminPage from "../app/admin/staff/page";
import RoleAdminPage from "../app/admin/role/page";
import MainLayoutPage from "../app/layout";
import WithAuth from "../components/utils/with-auth";
import LoginPage from "../app/login";
import BaseSettingPage from "../app/admin/base-setting/page";
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: ,
errorElement: ,
handle: {
crumb() {
return 主页;
},
},
children: [
{
path: "admin",
children: [
{
path: "base-setting",
element: (
),
handle: {
crumb() {
return (
基本设置
);
},
},
},
{
path: "department",
breadcrumb: "单位管理",
element: (
),
handle: {
crumb() {
return (
组织架构
);
},
},
},
{
path: "staff",
element: (
),
handle: {
crumb() {
return (
用户管理
);
},
},
},
{
path: "term",
breadcrumb: "分类配置",
element: (
),
handle: {
crumb() {
return 分类配置;
},
},
},
{
path: "role",
breadcrumb: "角色管理",
element: (
),
handle: {
crumb() {
return 角色管理;
},
},
},
],
},
],
},
{
path: "/login",
breadcrumb: "登录",
element: ,
},
];
export const router = createBrowserRouter(routes);