import { http } from "@/utils/http";

type ResultList = {
  code: number;
  msg: string;
  data: Array<any>;
};
type Result = {
  code: number;
  msg: string;
  data: boolean;
};
// 查询所有菜单
export const getMenuList = () => {
  return http.request<ResultList>("get", "/sysMenu/menuList");
};
// 查询角色的所有菜单权限表
export const getMenuListCodeForRole = params => {
  return http.request<ResultList>("get", "/sysMenu/menuListCodeForRole", {
    params
  });
};
export const getMenuListForUser = () => {
  return http.request<ResultList>("get", "/sysMenu/menuListForUser");
};
// 添加菜单权限
export const postAddMenuList = data => {
  return http.request<ResultList>("post", "/sysMenu/save", {
    data
  });
};
// 依据菜单code删除
export const delByCode = params => {
  return http.request<ResultList>("get", "/sysMenu/delByCode", {
    params
  });
};
// 更新菜单
export const updateMenu = params => {
  return http.request<Result>("get", "/sysMenu/updateMenu", {
    params
  });
};
