0👍
Try this:
Call the action like this:
this.$store.dispatch('store/get')
.then(r => {
// r contains the result, but you can call here the getter as well..
})
.catch(e => {
// catch every error here, you can handle here the error.
});
And the getter function is like this:
get: function(context) {
return axios.get(/api/call/get)
.then(r => {
... // mutations, conditions of data check.. throwing errors..
return r;
})
.catch(e => {
throw e;
})
}
I hope my thought is clear, but if it is not, comment your question(s)! 🙂
- [Vuejs]-Error: Request failed with status code 404 (Node.js + Vue.js)?
- [Vuejs]-Vue list doesn't "properly" re-render after being sorted
Source:stackexchange.com