vueuse / vueuse

Collection of essential Vue Composition Utilities for Vue 2 and 3

Home Page:https://vueuse.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[useFetch] Dependent Fetching

Kopf02 opened this issue · comments

Clear and concise description of the problem

As developer using VueUse using useFetch I want to be able to fetch Data depending on other fetches Response so that I'm able to use useFetch in more complex cases when I need a context of a request to even perform the second Request.

For example I need to perform a search and the Result doesn't contain the full data. I need the ID Returned from the search request to then get the Resource itself.

Suggested solution

In useFetch you could allow the URL to accept undefined / false / null. If you provide undefined / false / null the Request istn't performed initially. Instead it watches the URL until it contain a String to fetch.

Alternative

No response

Additional context

The Vue Plugin SWRV provides similar functionality and could be used as a reference. It isn't as flexible in its usage as useFetch. That's why I would rly enjoy useFetch to provide similar functionality.

Validations