거래내역 엑셀 다운로드
This commit is contained in:
39
src/entities/transaction/api/use-billing-excel-mutation.ts
Normal file
39
src/entities/transaction/api/use-billing-excel-mutation.ts
Normal 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,
|
||||
};
|
||||
};
|
||||
@@ -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),
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user