Nuxt Bridge : alternative to `useFetch()` in @nuxtjs/composition-api

552 Views Asked by At

I'm migrating from @nuxtjs/composition-api package to Nuxt Bridge and I see that useFetch is available only with Nuxt 3.

Before, I was using the pattern below:

const { state: userState, getUserList } = useUserList()
const { state: groupState, getGroupList } = useGroupList()    
// ...

const { fetchState } = useFetch(async () => {
 await Promise.all([
   getUserList(),
   getGroupList(),
   // ...
 ])
})

And I could use fetchState.pending to display a loader until everything was loaded.

How to have the behavior with Nuxt Bridge knowing that only useLazyAsyncData and useLazyFetch are compatible?

0

There are 0 best solutions below