import {getMenuList,addMenu,updateMenu,delMenu} from '@/api/menu'

const state = {

}

const mutations = {

}

const actions = {
  //1.动态路由 start ---------------------------------------->
  //获取路由列表
  getMenuList({commit},data) {
    return new Promise((resolve, reject) => {
      getMenuList(data).then(response => {
        resolve(response)
      }).catch(error => {
        reject(error)
      })
    })
  },
  //添加路由
  addMenu({commit},data) {
    return new Promise((resolve, reject) => {
      addMenu(data).then(response => {
        resolve(response)
      }).catch(error => {
        reject(error)
      })
    })
  },
  //修改路由
  updateMenu({commit},data) {
    return new Promise((resolve, reject) => {
      updateMenu(data).then(response => {
        resolve(response)
      }).catch(error => {
        reject(error)
      })
    })
  },
  //删除路由
  delMenu({commit},data) {
    return new Promise((resolve, reject) => {
      delMenu(data).then(response => {
        resolve(response)
      }).catch(error => {
        reject(error)
      })
    })
  },
  //资讯中心 end ---------------------------------------->
}


export default {
  namespaced: true,
  state,
  mutations,
  actions
}
