N
Nuxt3mo ago
Preyash

Is that possible to fetch data on delete item without manually calling fetchData?

what i wanna do is update the apidata on delete without calling fetchData() after delete. I've added watch(() => apidata, fetchData, { deep: true, once: true }); to achieve but not getting result. so is that possible? Pls see the attached file. Note: recently started exploring vue, so go easy
1 Reply
IcyFoxer
IcyFoxer3mo ago
Move your useFetch out of the function and put it in the setup scope. Set the params to immediate: false for useFetch. When u wan to make the api call. U can use useFetchVariable.execute()