async/await actions in Vuex
You're not await
ing the Vue.http.get()
promise in the getResource()
method, so await dispatch('getResource')
will resolve before the HTTP request has resolved.
Trimmed down:
async getResource() { let response try { response = await Vue.http.get('https://mysite/api/getResource') } catch (ex) { // Handle error return } // Handle success const data = response.body}