import axios from '@/utils/axios'

/**
 * 获取有权限的菜单树
 * @returns Promise
 */
// eslint-disable-next-line import/prefer-default-export
export function getMenuTree() {
  return axios.post('/sys/menu/tree')
}

export function getMenuTreeByRoleId(roleId: string) {
  return axios.post(`/sys/menu/tree/role/${roleId}`)
}

export function editRoleMenus(roleId: string, menuIds: Array<string>) {
  return axios.post(`/sys/menu/role/${roleId}`, menuIds)
}

export function getMenuTreeByPackageId(packageId: string) {
  return axios.post(`/sys/menu/tree/package/${packageId}`)
}

export function editPackageMenus(packageId: string, menuIds: Array<string>) {
  return axios.post(`/sys/menu/package/${packageId}`, menuIds)
}
