거래내역 엑셀 다운로드

This commit is contained in:
focp212@naver.com
2025-11-11 10:22:43 +09:00
parent 7c00077b6c
commit f72fcf0604
9 changed files with 150 additions and 16 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 {
BillingExcelParams,
BillingExcelResponse
} from '../model/types';
import {
useMutation,
UseMutationOptions
} from '@tanstack/react-query';
import { getHeaderUserAgent } from '@/shared/constants/url';
export const billingExcel = (params: BillingExcelParams) => {
let headerOptions = {
menuId: 34,
apiType: 'DOWNLOAD'
};
let options = {
headers: {
'X-User-Agent': getHeaderUserAgent(headerOptions)
}
};
return resultify(
axios.post<BillingExcelResponse>(API_URL_TRANSACTION.billingExcel(), params, options),
);
};
export const useBillingExcelMutation = (options?: UseMutationOptions<BillingExcelResponse, NiceAxiosError, BillingExcelParams>) => {
const mutation = useMutation<BillingExcelResponse, NiceAxiosError, BillingExcelParams>({
...options,
mutationFn: (params: BillingExcelParams) => billingExcel(params),
});
return {
...mutation,
};
};

View File

@@ -23,7 +23,7 @@ export const cashReceiptExcelDownload = (params: CashReceiptExcelDownloadParams)
}
};
return resultify(
axios.post<CashReceiptExcelDownloadResponse>(API_URL_TRANSACTION.cashReceiptReceiptDownload(), params, options),
axios.post<CashReceiptExcelDownloadResponse>(API_URL_TRANSACTION.cashReceiptExcelDownload(), params, options),
);
};

View File

@@ -12,7 +12,7 @@ import {
} from '@tanstack/react-query';
import { getHeaderUserAgent } from '@/shared/constants/url';
export const escrowDownloadExcelList = (params: EscrowDownloadExcelParams) => {
export const escrowDownloadExcel = (params: EscrowDownloadExcelParams) => {
let headerOptions = {
menuId: 33,
apiType: 'DOWNLOAD'
@@ -23,14 +23,14 @@ export const escrowDownloadExcelList = (params: EscrowDownloadExcelParams) => {
}
};
return resultify(
axios.post<EscrowDownloadExcelResponse>(API_URL_TRANSACTION.escrowList(), params, options),
axios.post<EscrowDownloadExcelResponse>(API_URL_TRANSACTION.escrowDownloadExcel(), params, options),
);
};
export const useEscrowListMutation = (options?: UseMutationOptions<EscrowDownloadExcelResponse, NiceAxiosError, EscrowDownloadExcelParams>) => {
export const useEscrowDownloadExcelMutation = (options?: UseMutationOptions<EscrowDownloadExcelResponse, NiceAxiosError, EscrowDownloadExcelParams>) => {
const mutation = useMutation<EscrowDownloadExcelResponse, NiceAxiosError, EscrowDownloadExcelParams>({
...options,
mutationFn: (params: EscrowDownloadExcelParams) => escrowDownloadExcelList(params),
mutationFn: (params: EscrowDownloadExcelParams) => escrowDownloadExcel(params),
});
return {