import { globalApi } from '@/api'

// 获取菜单数据
const GET_MEUMS = 'GET_MEUMS'

const state = {
  menus: []
}

const actions = {
  async getMenus ({
    commit, dispatch
  }, parmas) {
    let res = await globalApi.getMenus(parmas)
    let menus = res.data.data
    commit(GET_MEUMS, menus)
  }
}

const getters = {
  getMenus (state) {
    return state.menus
  }
}

const mutations = {
  [GET_MEUMS] (state, menus) {
    state.menus = menus
  }
}

export default {
  state,
  mutations,
  actions,
  getters
}
