This is how my current asyncData looks like, it's working and filling events and booking using axios calls
async asyncData({ params, app }) {
const events = await app.$api.event.index(app.i18n.locale)
const booking = await app.$api.event.getByPath(
app.i18n.locale,
params.detail
)
return {
events,
booking
}
},
But i need to add another object into data, registration, which needs a booking value to generate the axios url.
I tried in the booking's promise
async asyncData({ params, app }) {
let registration;
const events = await app.$api.event.index(app.i18n.locale)
const booking = await app.$api.event.getByPath(
app.i18n.locale,
params.detail
) .then((result) => {
registration = app.$api.event.getRegitrations(
app.i18n.locale,
result.id
)
});
return {
events,
booking,
registration
}
},
But this way booking is empty and registration has value [object Promise] (even that i see both axios responses in the dev tools)
How can I achieve that?