how to call action from another module vuex 1

how to call action from another module vuex

// action from one moduleA to moduleB
dispatch('moduleB/actionName', payload, { root:true })

Here is what the above code is Doing:
1. The `dispatch` function is used to dispatch Vuex actions.
2. The first argument is the name of the action to be dispatched.
3. The second argument is the payload.
4. The third argument is an object that contains the `root` property.
5. The `root` property is set to `true` to indicate that the action is being dispatched from a module.
6. The action is dispatched from the `moduleA` module to the `moduleB` module.

### Dispatching actions from a component

Similar Posts