Answer the question
In order to leave comments, you need to log in
How to return a value from a promise in Vuex?
There is such an action:
actions: {
getAllData(context) {
console.log(new Date());
return new Promise((resolve, reject) => {
HTTP.post(Routes.getResidentialsOnMap, {})
.then(({ data }) => {
console.log(new Date());
console.log('data: ', data);
context.commit('getAllData', data);
resolve(data);
})
.catch(error => {
console.error(error);
reject(error);
});
})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question