I have an axios call in my vuex actions
return axios({
method: 'get',
url: `/myurl`,
}).then(function (response) {
context.commit('value', response.data.data);
}),
However this is called in my component
this.$store.dispatch("fetchmystuff")
How do I return a value to the component?
In the past I have attached the then() to the dispatch
this.$store.dispatch("fetchmystuff")
.then(function (response) {
//do some component stuff
}),
but I would like to run the commit first in vuex, then return something to the component.