api 추가
This commit is contained in:
@@ -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,
|
||||
};
|
||||
};
|
||||
@@ -292,6 +292,22 @@ export interface CashReceiptReceiptDownloadResponse {
|
||||
customerInfo: CustomerInfo;
|
||||
productInfo: ProductInfo;
|
||||
};
|
||||
|
||||
export enum CashReceiptDateType {
|
||||
ISSUE_DATE = 'ISSUE_DATE',
|
||||
CANCEL_DATE = 'CANCEL_DATE'
|
||||
};
|
||||
export interface CashReceiptExcelDownloadParams {
|
||||
email: string;
|
||||
mid: string;
|
||||
startDate: string;
|
||||
endDate: string;
|
||||
dateType: CashReceiptDateType;
|
||||
purposeType: CashReceiptPurposeType;
|
||||
transactionType: CashReceiptTransactionType;
|
||||
processResult: CashReceiptProcessResult;
|
||||
};
|
||||
export interface CashReceiptExcelDownloadResponse {};
|
||||
export interface EscrowListParams {
|
||||
mid?: string;
|
||||
searchType?: string;
|
||||
|
||||
@@ -428,7 +428,7 @@ export const AmountInfoSection = ({
|
||||
}
|
||||
<div className="txn-doc">
|
||||
{ (transactionCategory === TransactionCategory.CashReceipt) &&
|
||||
// !!canDownloadReceipt &&
|
||||
!!canDownloadReceipt &&
|
||||
<button
|
||||
className="doc-btn"
|
||||
type="button"
|
||||
@@ -446,7 +446,7 @@ export const AmountInfoSection = ({
|
||||
sendRequest={ onRequestDownload }
|
||||
></DownloadBottomSheet>
|
||||
}
|
||||
{
|
||||
{ !!cashReceiptSampleOn &&
|
||||
<CashReceiptSample
|
||||
cashReceiptSampleOn={ cashReceiptSampleOn }
|
||||
setCashReceiptSampleOn={ setCashReceiptSampleOn }
|
||||
|
||||
Reference in New Issue
Block a user