mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-06-26 04:50:36 +03:00
19 lines
481 B
TypeScript
19 lines
481 B
TypeScript
import { useMutation } from '@tanstack/react-query';
|
|
|
|
import { DataCallback } from '@/backend/apiTransport';
|
|
|
|
import { cctextApi, ITextResult } from './api';
|
|
|
|
export const useParseText = () => {
|
|
const mutation = useMutation({
|
|
mutationKey: [cctextApi.baseKey, 'parse-text'],
|
|
mutationFn: cctextApi.parseText
|
|
});
|
|
return {
|
|
parseText: (
|
|
data: { text: string }, //
|
|
onSuccess?: DataCallback<ITextResult>
|
|
) => mutation.mutate(data, { onSuccess })
|
|
};
|
|
};
|