refactor: ♻️ 角色的路由权限判断移至后端

This commit is contained in:
ray
2024-06-29 14:25:24 +08:00
parent f59d8987ee
commit 322607504f
5 changed files with 62 additions and 121 deletions

View File

@@ -8,9 +8,12 @@ class MenuAPI {
*
* @returns 路由列表
*/
static getRoutes() {
static getRoutes(roles: string[]) {
const queryParams = roles
.map((role) => `roles=${encodeURIComponent(role)}`)
.join("&");
return request<any, RouteVO[]>({
url: `${MENU_BASE_URL}/routes`,
url: `${MENU_BASE_URL}/routes?${queryParams}`,
method: "get",
});
}
@@ -202,8 +205,6 @@ export interface Meta {
icon?: string;
/** 【菜单】是否开启页面缓存 */
keepAlive?: boolean;
/** 拥有路由权限的角色编码 */
roles?: string[];
/** 路由title */
title?: string;
}