Closed
Description
Hi, I have been trying to fixing this issue for 2 days. It always Triggers Mutation but not actions.
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex);
const roommsgs = {
state: {
roommsgs: []
},
mutations: {
SOCKET_CONNECT(state, status) {},
SOCKET_ROOMCHAT(state, roomchat) {
state.roommsgs.push(roomchat);
}
},
actions: {
socket_roomChat: async ({
commit,
dispatch
}, message) => {
dispatch('socket_roomChat', message);
commit('SOCKET_ROOMCHAT', message);
}
},
getters: {
getChatByRoom: (state) => (room_name) => {
return state.roommsgs.find(roommsgs => roommsgs.roomname === room_name)
}
}
};
const notifications = {
state: {
notifications: []
},
mutations: {
SOCKET_NOTIFICATIONS(state, message) {
state.notifications.push({
type: 'notifications',
payload: message
});
}
},
}
export default new Vuex.Store({
modules: {
roommsgs,
notifications,
}
})
Is there anything else should I consider?