Mutation is not set value no state.
The problem is that the state is not being updated.
What I'm doing wrong.
Mutation
function cardValidationSet (state, data) {
state.cardValided = data
}
Getters
function cardValidationget (state) {
return state.cardValided
}
Component A
import Store from '../store'
display: function () {
Store().commit('disponivel/cardValidationSet', valided)
}
Component B
import { mapGetters, mapActions, mapMutations } from 'vuex'
computed: {
...mapGetters('disponivel', ['cardValidationget'])
},
methods: {
onSubmitPay () {
console.log(this.cardValidationget)
},
}
if you have setup Vuex properly, the right way to commit a mutation is
this.$store.commit('disponivel/cardValidationSet', valided)