N
Nuxt10mo ago
itmaster

How to I can make loading with useAsyncdata?

//composable/use-api.ts
export const useBaseFetch = <T>(url: string) => {
const { setLoading } = useStore()
const _fetch = useAsyncData(key, () => $fetch(urlWithQuery.value)
watch(_fetch.pending, (v) => {
// console.log(v); // always false
setLoading(v)
})
return _fetch;
}
//composable/use-api.ts
export const useBaseFetch = <T>(url: string) => {
const { setLoading } = useStore()
const _fetch = useAsyncData(key, () => $fetch(urlWithQuery.value)
watch(_fetch.pending, (v) => {
// console.log(v); // always false
setLoading(v)
})
return _fetch;
}
pending value is always false so I can't loading spinner what is my wrong? thanks
3 Replies
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
itmaster
itmasterOP10mo ago
Thanks for your reply I will try it is working well Thanks again
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server