// import { http } from '../http'
import http from '../http'
import global from '../config'

export default {
  page: data => http.post('/v1/resource/page', data).then(res => res),
  add: data => http.post('/v1/resource/', data).then(res => res),
  edit: data => http.put('/v1/resource/' + data.id, data.obj).then(res => res),
  getById: data => http.get('/v1/resource/vo-' + data).then(res => res),
  // 获取导航菜单
  getNavMenu: () =>
    http.post('/v1/resource/nav-menu-' + global.getCode()).then(res => res),
  // 获取已授权的按钮
  getBtn: data => http.post('/v1/resource/list-btn', data).then(res => res),

  getMenuTree: data =>
    http.post('/v1/resource/menu-tree', data).then(res => res),
  // 分配权限
  // promissionTreeKey: data =>
  //   http.post('/base/v1/resource/menu_tree?name=' + data).then(res => res),
  // 菜单tree
  menuTreeList: data =>
    http.post('/v1/resource/menu-tree', data).then(res => res),
  // btn
  btnPage: data => http.post('/v1/resource/page-btn', data).then(res => res),
  btnAdd: data =>
    http.post('/v1/resource/btn-' + data.menuId, data.obj).then(res => res)
}
