Portal/rsconcept/frontend/src/features/oss/backend/useFindPredecessor.tsx

16 lines
460 B
TypeScript
Raw Normal View History

import { useMutation, useQueryClient } from '@tanstack/react-query';
2025-01-23 19:41:31 +03:00
import { ossApi } from './api';
export const useFindPredecessor = () => {
const client = useQueryClient();
2025-01-23 19:41:31 +03:00
const mutation = useMutation({
mutationKey: [ossApi.baseKey, 'find-predecessor'],
mutationFn: ossApi.getPredecessor,
onError: () => client.invalidateQueries()
2025-01-23 19:41:31 +03:00
});
return {
findPredecessor: (target: number) => mutation.mutateAsync({ target: target })
2025-01-23 19:41:31 +03:00
};
};