Calling an Action in Another Module from Vuex
You can use dispatch.
const callActionInOtherModule = async (store, { payload }) => {
try {
store.dispatch("moduleB/actionName", { payload }, { root: true });
} catch (e) {
console.error(e);
}
};
Make sure to include { root: true }.
Leave a comment