import axios from '~plugins/axios' import config from '../nuxt.config' export const actions = { // 获取未读消息数量 loadMessageCount({ commit }, params = {}) { commit('messageCount/REQUEST_MESSAGE_COUNT') return axios.get('/messages/count', {params}) .then(response => { commit('messageCount/REQUEST_MESSAGE_COUNT_SUCCESS', response.data) }, err => { commit('messageCount/REQUEST_MESSAGE_COUNT_FAILURE', err) }) }, // 获取全部消息 getAllMessage({ commit }, params = {}) { commit('messageList/REQUEST_MESSAGE_LIST') return axios.get(`${config.env.messageUrl}/messages`, {params}) .then(response => { commit('messageList/GET_MESSAGE_LIST_SUCCESS', response.data) }, err => { commit('messageList/GET_MESSAGE_LIST_FAILURE', err) }) } }