api 추가

This commit is contained in:
focp212@naver.com
2025-11-10 18:03:38 +09:00
parent f547ec2c39
commit 5d398c9d77
5 changed files with 70 additions and 2 deletions

View File

@@ -0,0 +1,39 @@
import axios from 'axios';
import { API_URL_TRANSACTION } from '@/shared/api/api-url-transaction';
import { resultify } from '@/shared/lib/resultify';
import { NiceAxiosError } from '@/shared/@types/error';
import {
CashReceiptExcelDownloadParams,
CashReceiptExcelDownloadResponse
} from '../model/types';
import {
useMutation,
UseMutationOptions
} from '@tanstack/react-query';
import { getHeaderUserAgent } from '@/shared/constants/url';
export const cashReceiptExcelDownload = (params: CashReceiptExcelDownloadParams) => {
let headerOptions = {
menuId: 32,
apiType: 'DOWNLOAD'
};
let options = {
headers: {
'X-User-Agent': getHeaderUserAgent(headerOptions)
}
};
return resultify(
axios.post<CashReceiptExcelDownloadResponse>(API_URL_TRANSACTION.cashReceiptReceiptDownload(), params, options),
);
};
export const useCashReceiptExcelDownloadMutation = (options?: UseMutationOptions<CashReceiptExcelDownloadResponse, NiceAxiosError, CashReceiptExcelDownloadParams>) => {
const mutation = useMutation<CashReceiptExcelDownloadResponse, NiceAxiosError, CashReceiptExcelDownloadParams>({
...options,
mutationFn: (params: CashReceiptExcelDownloadParams) => cashReceiptExcelDownload(params),
});
return {
...mutation,
};
};