2025-01-27 15:03:48 +03:00
|
|
|
import { useMutation } from '@tanstack/react-query';
|
|
|
|
|
|
|
|
import { DataCallback } from '@/backend/apiTransport';
|
2025-02-10 01:32:55 +03:00
|
|
|
import { IConstituentaReference, ITargetCst } from '@/features/rsform/models/rsform';
|
2025-01-27 15:03:48 +03:00
|
|
|
|
|
|
|
import { ossApi } from './api';
|
|
|
|
|
|
|
|
export const useFindPredecessor = () => {
|
|
|
|
const mutation = useMutation({
|
|
|
|
mutationKey: [ossApi.baseKey, 'find-predecessor'],
|
|
|
|
mutationFn: ossApi.getPredecessor
|
|
|
|
});
|
|
|
|
return {
|
|
|
|
findPredecessor: (
|
|
|
|
data: ITargetCst, //
|
|
|
|
onSuccess?: DataCallback<IConstituentaReference>
|
|
|
|
) => mutation.mutate(data, { onSuccess })
|
|
|
|
};
|
|
|
|
};
|