mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-06-26 13:00:39 +03:00
18 lines
473 B
TypeScript
18 lines
473 B
TypeScript
![]() |
import { useMutation } from '@tanstack/react-query';
|
||
|
|
||
|
import { DataCallback } from '../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 })
|
||
|
};
|
||
|
};
|