3๐
โ
Actions are similar to mutations, the differences being that: Instead of mutating the state, actions commit mutations.
You need to commit
a mutation instead of directly altering state
:
state: {
...
fisrtStepInfo: {}
},
mutations: {
setStepInfo: (state, data) => state.fisrtStepInfo = data;
}
actions: {
formInfo({commit, dispatch}, authData) {
console.log(authData)
commit('setStepInfo', authData)
console.log(this.fisrtStepInfo)
}
},
getters: {
formInfoFirstStep (state) {
console.log(state)
return state.fisrtStepInfo
}
}
๐คDaniel_Knights
Source:stackexchange.com