30 lines
1.3 KiB
TypeScript
30 lines
1.3 KiB
TypeScript
import axios from 'axios';
|
|
import { API_URL_ADDITIONAL_SERVICE } from '@/shared/api/api-url-additional-service';
|
|
import { resultify } from '@/shared/lib/resultify';
|
|
import { CBDCAxiosError } from '@/shared/@types/error';
|
|
import {
|
|
ExtensionFundAccountDownloadReceiptParams as ExtensionFundAccountDownloadReceiptParams,
|
|
ExtensionFundAccountDownloadReceiptResponse as ExtensionFundAccountDownloadReceiptResponse
|
|
} from '../../model/fund-account/types';
|
|
import {
|
|
useMutation,
|
|
UseMutationOptions
|
|
} from '@tanstack/react-query';
|
|
|
|
export const extensionFundAccountDownloadReceipt = (params: ExtensionFundAccountDownloadReceiptParams) => {
|
|
return resultify(
|
|
axios.post<ExtensionFundAccountDownloadReceiptResponse>(API_URL_ADDITIONAL_SERVICE.extensionFundAccountDownloadReceipt(), params),
|
|
);
|
|
};
|
|
|
|
export const useExtensionFundAccountDownloadReceiptMutation = (options?: UseMutationOptions<ExtensionFundAccountDownloadReceiptResponse, CBDCAxiosError, ExtensionFundAccountDownloadReceiptParams>) => {
|
|
const mutation = useMutation<ExtensionFundAccountDownloadReceiptResponse, CBDCAxiosError, ExtensionFundAccountDownloadReceiptParams>({
|
|
...options,
|
|
mutationFn: (params: ExtensionFundAccountDownloadReceiptParams) => extensionFundAccountDownloadReceipt(params),
|
|
});
|
|
|
|
return {
|
|
...mutation,
|
|
};
|
|
};
|