create mutation

This commit is contained in:
1 2024-05-27 14:07:13 +02:00
parent d34673a490
commit 35745d752d

View File

@ -6,7 +6,7 @@ import { sendRequest } from './api';
const useOfflineMutation = () => {
const queryClient = useQueryClient();
const mutation = queryClient.setMutationDefaults(sendRequest, {
queryClient.setMutationDefaults(['sendRequest'], {
onMutate: async (newData) => {
await queryClient.cancelQueries('data');
@ -24,6 +24,8 @@ const useOfflineMutation = () => {
},
});
const mutation = useMutation({mutationKey: ['sendRequest']});
return mutation;
};