[Vuejs]-Vuejs : best way to call multiple actions from vuex

0👍

Create a new special action which will dispatch all the others:

actions: {
  FETCH_AB: ()  => {
    // ...
  },
  FETCH_DS: ()  => {
    // ...
  },
  FETCH_SD: ()  => {
    // ...
  },
  // Rest of the actions...


  FETCH_ALL: ({ dispatch }) => {
    // Dispatch all the actions here
    dispatch('FETCH_AB');
    dispatch('FETCH_DS');
    dispatch('FETCH_SD');
    //...
  }
}

Leave a comment