[useFetch] Feautre request: use refetch also for POST data
See original GitHub issueCurrently useFetch
can resend request if I change url. But it would be nice to have the same function if POST data is also changed.
So it can be possible to do something like that:
function useSearch() {
const query = ref('') // Connect to text input
const debouncedQuery = ref('')
// Add delay to not call API while user is typing
debouncedWatch(query, (query: string) => (debouncedQuery.value = query), { debounce: 500 })
const { data } = useFetch('https://example.com/search', {
immediate: false,
refetch: true,
})
.post({ q: query}) // or reactive({ q: query})
.json()
return { query, data }
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
When To Use Refetch Queries in Apollo Client
In this post, I'll explain when it makes sense to use refetchQueries , and when you should rely on Apollo Client's automatic cache ......
Read more >How to refetch properly an API request after an event occurred?
Just move the api call to a function and call it in the useEffect, onclick or form submit useEffect( () => { apiCall()...
Read more >Fetching and Updating Data with React Query
We will use the useMutation() hook, which returns an isLoading, error, and mutate function that will be used to make requests and enfold...
Read more >Refreshing Server-Side Props - Next.js - Josh W Comeau
js to re-fetch the data, on demand, without doing a hard refresh of the whole page? In this short tutorial, I'll share the...
Read more >2.3 HTTP Post Request with fetch() - YouTube
https://github.com/CodingTrain/Intro-to- Data -APIs-JS We are now in Module #2! In the previous module, we focused on client-side JavaScript.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Going to close this out in favor of using something like @isgj suggested
You can call
post
indebounceWatch
like