I need to call vuex module it doesn't work. I've seen the documentation but still it doesn't work. Hope someone can help me.
const stateLocations ={
state: {
provinces: {},
cities: {}
},
mutations: {
provinces(state, payload){
state.provinces = payload
}
}
}
const store = new Vuex.Store({
modules: {
locations: stateLocations
}
})
My code to call the mutations
created(){
var store = this.$store
axios.get('api/provinces')
.then( function(response){
store.state.locations.commit('provinces', response.data)
})
.catch()
}
This one doesn't work store.state.locations.commit('provinces', response.data)
TY
actions
section of the vuex module. – N. Kudryavtsev Mar 6 '19 at 18:25