I'd like to use the value returned from a function called inside my template.
template:
<div class="director">
{{ fetchDirector(movie.imdbId) }}
</div>
vue.js:
async fetchDirector(movieId) {
try {
await axios.post(`http://www.omdbapi.com/?i=${movieId}&apikey=...`)
.then((res) => {
return ( res.data.Director )
})
} catch(err) {
console.log(err);
}
}
I can't figure out how to display the [object Promise] value fetchDirector(movie.imdbId) gives.. Thank you!