import { getMenuList, menuEnable, menuDisable } from '@/api/menu.js'

const menuInfo = {
  state: {

  },
  mutations: {

  },
  actions: {
    GetMenuList({ commit }) { // 获取菜单列表
      return new Promise((resolve, reject) => {
        getMenuList().then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    MenuEnable({ commit }, id) { // 启用菜单
      return new Promise((resolve, reject) => {
        menuEnable(id).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    },
    MenuDisable({ commit }, id) { // 停用菜单
      return new Promise((resolve, reject) => {
        menuDisable(id).then(response => {
          resolve(response)
        }).catch(error => {
          reject(error)
        })
      })
    }
  }
}

export default menuInfo
