2
My request is returning this to me:
data: Promise
Opening Chrome Developer Tools I see this:
data: Promise
__proto__:Promise
[[PromiseStatus]]:"resolved"
[[PromiseValue]]:"24/01/2016"
Using Axios, how is it possible to print this value ?
Lista (url) {
axios.get(url)
.then(res => res.data)
.then(res => this.publicacaoList = res.map( (contato) => ({
data: axios.get(contato.id_url).then(res => res.data.data_registro).catch(e => console.log(e)),
email: contato.email,
tel: contato.tel
}) ) )
.catch(e => {
console.log(e)
})
}
Where to contact.id_url is a url where I request to find the date. The email table fields and tel return normally, the date field returns an empty object {}
If we make a suggestion with
async/await
you have to compile?– Sergio
Unfortunately I won’t be able to test, I already quit the internship and the api I was consuming I don’t have access at home. But I will continue studying javascript and Monday I will probably be able to solve it. Monday I’ll come back with the answer. Thank you so much for always trying to help me
– user90136
This can be solved with chained Promises, but with
async/await
is even easier. You’re usingwebpack
?– Sergio
Yes, webpack. I’m really enjoying Vue, I bought an ebook today (The Majesty of Vue.js 2) and I will try to read and practice this weekend, so next week I will be able to do a CRUD.
– user90136