Proper Way to Call Multiple Mutations in Vuex

4.4k Views Asked by At

I have the following setup for an action:

    myAction: ({commit}) => {
    commit('mutation1');
    commit('mutation2');
    commit('mutation3');
},

The thing is, I need mutation1 to for sure run first (which it does most of the time) and I need mutation2 to only run if mutation1 succeeds, and so on for mutation3. Since calling a mutation won't return anything, I'm figuring there has to be a better way to do what I'm trying to do. Is there a best practice for calling multiple mutations that depend on the previous mutation to succeed?

0

There are 0 best solutions below