Change another module state from one module in Vuex
Try it with following parameters as suggested here;
commit('TOGGLE_LOADING', null, { root: true })
If you have namespaced
set to true (in Nuxt that's the default when in modules mode), this becomes:
commit('loading/TOGGLE_LOADING', null, { root: true })
you can use action to commit mutation which defined in another module,then you will modify state in another module.
like this:
posts: {
actions: {
toggleSavingActions(context) {
// some actions
context.commit("TOGGLE_SAVING"); // defined in loading module
}
}
}