wireguard-dashboard/web-src/mock/asyncRoutes.ts

53 lines
1.0 KiB
TypeScript
Raw Permalink Normal View History

2024-06-04 09:55:48 +08:00
// 模拟后端动态生成路由
import { defineFakeRoute } from "vite-plugin-fake-server/client";
/**
* roles "user""common"
* user
* common
*/
const permissionRouter = {
path: "/permission",
meta: {
title: "权限管理",
icon: "ep:lollipop",
rank: 10
},
children: [
{
path: "/permission/page/index",
name: "PermissionPage",
meta: {
title: "页面权限",
roles: ["user", "common"]
}
},
{
path: "/permission/button/index",
name: "PermissionButton",
meta: {
title: "按钮权限",
roles: ["user", "common"],
auths: [
"permission:btn:add",
"permission:btn:edit",
"permission:btn:delete"
]
}
}
]
};
export default defineFakeRoute([
{
url: "/get-async-routes",
method: "get",
response: () => {
return {
success: true,
data: [permissionRouter]
};
}
}
]);