import { home_noticeCount } from '@/api/business/home/home'

const menuCount = {
  state: {
    //未读通知数量
    noticeCount: 0
  },

  mutations: {
    SET_MENU_COUNT: (state, d) => {
      state.noticeCount = d.noticeCount
    }
  },
  actions: {
    GetMenuCount({ commit, state }) {
      return new Promise((resolve, reject) => {
        home_noticeCount()
          .then((res) => {
            commit('SET_MENU_COUNT', res.data)
            resolve(res)
          })
          .catch((error) => {
            reject(error)
          })
      })
    }
  }
}

export default menuCount
