Replies: 2 comments
-
Hi, please refer to this page: https://react-query.tanstack.com/guides/query-cancellation |
Beta Was this translation helpful? Give feedback.
0 replies
-
Ok, I see. I quickly wrote something related to the functionality I can use on my project. I will test. Really nice stuff btw // composables/useCancelableQuery.js
export function useCancelableQuery = (key, url, params = {}) => {
const controller = new AbortController()
const { signal } = controller
const { isLoading, isError, data, error } = useQuery(key, () => axios.get(url, { ...params, signal }))
const doCancel = () => { controller.abort() }
return {
isLoading,
isError,
data,
error,
doCancel
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Is there a way to cancel a request, via the native Web API AbortController ?
Beta Was this translation helpful? Give feedback.
All reactions