I tried to set the interval for the function to delete it when the component will be destroyed but get this error. And can't find any solution for this.
My interval function:
<script>
export default {
data: () => ({
ordersInterval: null,
}),
async fetch() {
const data = await this.$axios.post(`${this.apiURL}orders`, {
per_page: this.$store.state.pagination.per_page,
page: this.$store.state.pagination.current_page,
})
this.orders = data.data.data
this.$store.dispatch('changePaginationData', {
paginationData: data.data.meta,
})
this.ordersInterval = setInterval(() => {
this.filterOrders()
}, 10000)
},
}
</script>
How can I fix this error?