Vuex에서 다른 모듈의 action 호출하기
dispatch
를 쓰면 된다.
const callActionInOtherModule = async (store, { payload }) => {
try {
store.dispatch("moduleB/actionName", { payload }, { root: true });
} catch (e) {
console.error(e);
}
};
{ root: true }
를 꼭 넣어야 한다.
Leave a comment