refactor: ♻️ 获取路由接口移除角色参数,后端从token解析角色

This commit is contained in:
ray
2024-06-29 15:22:24 +08:00
parent 322607504f
commit 097a3fabea
3 changed files with 46 additions and 42 deletions

View File

@@ -4,16 +4,15 @@ const MENU_BASE_URL = "/api/v1/menus";
class MenuAPI {
/**
* 获取路由列表
* 获取当前用户的路由列表
* <p/>
* 无需传入角色后端解析token获取角色自行判断是否拥有路由的权限
*
* @returns 路由列表
*/
static getRoutes(roles: string[]) {
const queryParams = roles
.map((role) => `roles=${encodeURIComponent(role)}`)
.join("&");
static getRoutes() {
return request<any, RouteVO[]>({
url: `${MENU_BASE_URL}/routes?${queryParams}`,
url: `${MENU_BASE_URL}/routes`,
method: "get",
});
}