Spaces:
Build error
Build error
File size: 556 Bytes
b59aa07 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import { useMutation, useQueryClient } from "@tanstack/react-query";
import ApiKeysClient from "#/api/api-keys";
import { API_KEYS_QUERY_KEY } from "#/hooks/query/use-api-keys";
export function useDeleteApiKey() {
const queryClient = useQueryClient();
return useMutation({
mutationFn: async (id: string): Promise<void> => {
await ApiKeysClient.deleteApiKey(id);
},
onSuccess: () => {
// Invalidate the API keys query to trigger a refetch
queryClient.invalidateQueries({ queryKey: [API_KEYS_QUERY_KEY] });
},
});
}
|