isn't there any answer?
Feb 20, 2019
2
Level 2
How to get a calling function in Vuex?
Hi. I would like to get the calling function of a mutation? I want to call same mutation function ( updateProjects ) from an action function to delete projects from projects store and to add new projects. Because of that I need to know which action function is calling the mutation. How Can i do that?
state : {
projects : []
}
mutations: {
updateProjects () {
if (calllingFunction == delete) {
do delete ops..
} elseif (callingFunction == update) {
do update ops...
}
}
actions : {
deleteProject ({commit}, payload) {
commit("updateProjects", payload)
},
addProject ({commit}, payload) {
commit("updateProjects", payload)
}
}
something like that.
Please or to participate in this conversation.