Hello I want to recall asyncData function in methods or another solution when do the call api because i want to do a $emit
when call this action which resets data
I do that but is don't work
index.vue
<template>
<my-orders
:orders="orders
@sendData="initOrders"
/>
</template>
<script>
async asyncData({ $axios }) {
const orders = await endpoint.getOrders({ $axios });
return {
orders
};
},
methods: {
async initOrders() {
await this.asyncData
},
}
</script>
Please help thank you
CodePudding user response:
this.$nuxt.refresh()
can help you re-fetch any fetch()
or asyncData()
hooks.