What is the best approach to transform this Nuxt script into a Vue-compatible one?
<script>
export default {
components: {
FeaturedProduct
},
async asyncData({ axios }) {
try {
let response = await axios.get(
'http://localhost:5000/api/products'
)
console.log(response)
return {
products: response.products
}
} catch (error) {}
}
}
</script>
How should I handle this in Vue? When I remove the $
, I encounter the following error message
axios not defined