One thing I am struggling with is setting data from my component to the store.
methods: { // Inside my component
...mapMutations('lists', ['setContactListName']),// Importing function from the store
viewHandler (id, item) { // Handler function
this.$router.push(`/company/sample-contact/${id}`);
this.setContactListName(item); // Passing data to the function
}
}
state() { // Store setup
return {
contactListName: {}
};
},
mutations:{
setContactListName (state, payload) {// Mutation function
state.contactListName = payload;
}
}
Even after clicking, nothing seems to happen - there are no errors in the console.