mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-18 07:23:51 +01:00
GraphQL autocomplete and duplicate request
This commit is contained in:
@@ -1,17 +1,11 @@
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
import { useMutation } from '@tanstack/react-query';
|
||||
import { invoke } from '@tauri-apps/api';
|
||||
import { responsesQueryKey } from './useResponses';
|
||||
|
||||
export function useSendRequest(id: string | null) {
|
||||
const queryClient = useQueryClient();
|
||||
return useMutation<void, string>({
|
||||
mutationFn: async () => {
|
||||
if (id === null) return;
|
||||
await invoke('send_request', { requestId: id });
|
||||
},
|
||||
onSuccess: async () => {
|
||||
if (id === null) return;
|
||||
await queryClient.invalidateQueries(responsesQueryKey(id));
|
||||
},
|
||||
}).mutate;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user