0👍
After you export the getCorporateRequests()
and import it in the component
Your getCorporateRequests
function is not returning a promise so you cannot use getCorporateRequests().then()
so make your getCorporateRequests()
return a promise
filename: service.js
let getCorporateRequests = function() {
let url = "http://corptest.mocklab.io/thing/2";
return Vue.axios.get(url);
}
now in your component you can chain a then()
as follows:
service.getCorporateRequests().then(function(data){
console.log(data);
})`
- [Vuejs]-Show/hide a vue-strap spinner from parent or child component
- [Vuejs]-Is there a way to detect when the actual DOM render completes?
Source:stackexchange.com