Skip to content

Instantly share code, notes, and snippets.

@caioaao
Created April 9, 2021 20:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save caioaao/d81285a17fa5476ee2d3043028dfc769 to your computer and use it in GitHub Desktop.
Save caioaao/d81285a17fa5476ee2d3043028dfc769 to your computer and use it in GitHub Desktop.
export const useCancelTask = (taskUUID: string) => {
const queryClient = useQueryClient();
return useMutation(
() => (
api.cancelTask(taskUUID).then(res => res.data)
), {
onSuccess: data => defaultOnSuccess(queryClient, data),
mutationKey: ["tasks", "cancel", {uuid: taskUUID}],
}
);
}
export const useCancelTask = () => {
const queryClient = useQueryClient();
return useMutation(
(taskUUID: string) => (
api.cancelTask(taskUUID).then(res => res.data)
), {
onSuccess: data => defaultOnSuccess(queryClient, data),
mutationKey: ["tasks", "cancel"],
}
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment