catch 수정 및 불필요 api 삭제 api 변경 내역 수정
This commit is contained in:
@@ -1,39 +0,0 @@
|
||||
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 {
|
||||
DownloadConfirmationParams,
|
||||
DownloadConfirmationResponse
|
||||
} from '../model/types';
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions
|
||||
} from '@tanstack/react-query';
|
||||
import { getHeaderUserAgent } from '@/shared/constants/url';
|
||||
|
||||
export const downloadConfirmation = (params: DownloadConfirmationParams) => {
|
||||
let headerOptions = {
|
||||
menuId: 31,
|
||||
apiType: 'DOWNLOAD'
|
||||
};
|
||||
let options = {
|
||||
headers: {
|
||||
'X-User-Agent': getHeaderUserAgent(headerOptions)
|
||||
}
|
||||
};
|
||||
return resultify(
|
||||
axios.post<DownloadConfirmationResponse>(API_URL_TRANSACTION.transactionDownloadConfirmation(), params, options),
|
||||
);
|
||||
};
|
||||
|
||||
export const useDownloadConfirmationMutation = (options?: UseMutationOptions<DownloadConfirmationResponse, NiceAxiosError, DownloadConfirmationParams>) => {
|
||||
const mutation = useMutation<DownloadConfirmationResponse, NiceAxiosError, DownloadConfirmationParams>({
|
||||
...options,
|
||||
mutationFn: (params: DownloadConfirmationParams) => downloadConfirmation(params),
|
||||
});
|
||||
|
||||
return {
|
||||
...mutation,
|
||||
};
|
||||
};
|
||||
@@ -282,7 +282,7 @@ export interface CashReceiptSummaryResponse {
|
||||
totalCount: number;
|
||||
};
|
||||
export interface CashReceiptReceiptDownloadParams {
|
||||
approvalNumber: string;
|
||||
tid: string;
|
||||
};
|
||||
export interface CashReceiptReceiptDownloadResponse {
|
||||
issueInfo: IssueInfo;
|
||||
@@ -580,14 +580,6 @@ export interface InfoSectionProps extends DetailResponse {
|
||||
canDownloadReceipt?: boolean;
|
||||
}
|
||||
|
||||
|
||||
export interface DownloadConfirmationParams {
|
||||
tid?: string;
|
||||
};
|
||||
export interface DownloadConfirmationResponse {
|
||||
|
||||
};
|
||||
|
||||
export interface DownloadExcelParams {
|
||||
tid?: string
|
||||
};
|
||||
|
||||
@@ -32,6 +32,7 @@ import {
|
||||
import { FullMenuClose } from '@/entities/common/ui/full-menu-close';
|
||||
import { checkGrant } from '@/shared/lib/check-grant';
|
||||
import { showAlert } from '@/widgets/show-alert';
|
||||
import { snackBar } from '@/shared/lib';
|
||||
|
||||
export interface AllTransactionDetailProps {
|
||||
detailOn: boolean;
|
||||
@@ -79,7 +80,7 @@ export const AllTransactionDetail = ({
|
||||
setPartCancelInfo(rs.partCancelInfo);
|
||||
}).catch((e: any) => {
|
||||
if(e.response?.data?.error?.message){
|
||||
showAlert(e.response?.data?.error?.message);
|
||||
snackBar(e.response?.data?.error?.message);
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -14,6 +14,7 @@ import { NumericFormat } from 'react-number-format';
|
||||
import { DetailMotionDuration, DetailMotionStyle, DetailMotionVariants } from '@/entities/common/model/constant';
|
||||
import { FullMenuClose } from '@/entities/common/ui/full-menu-close';
|
||||
import { showAlert } from '@/widgets/show-alert';
|
||||
import { snackBar } from '@/shared/lib';
|
||||
|
||||
export interface BillingDetailProps {
|
||||
detailOn: boolean;
|
||||
@@ -45,7 +46,7 @@ export const BillingDetail = ({
|
||||
})
|
||||
}).catch((e: any) => {
|
||||
if(e.response?.data?.error?.message){
|
||||
showAlert(e.response?.data?.error?.message);
|
||||
snackBar(e.response?.data?.error?.message);
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -71,7 +71,7 @@ export const CashReceiptDetail = ({
|
||||
}, 2000);
|
||||
}).catch((e: any) => {
|
||||
if(e.response?.data?.error?.message){
|
||||
showAlert(e.response?.data?.error?.message);
|
||||
snackBar(e.response?.data?.error?.message);
|
||||
return;
|
||||
}
|
||||
});
|
||||
@@ -94,7 +94,7 @@ export const CashReceiptDetail = ({
|
||||
}
|
||||
}).catch((e: any) => {
|
||||
if(e.response?.data?.error?.message){
|
||||
showAlert(e.response?.data?.error?.message);
|
||||
snackBar(e.response?.data?.error?.message);
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -29,6 +29,7 @@ import { DetailMotionDuration, DetailMotionStyle, DetailMotionVariants } from '@
|
||||
import { FullMenuClose } from '@/entities/common/ui/full-menu-close';
|
||||
import { checkGrant } from '@/shared/lib/check-grant';
|
||||
import { showAlert } from '@/widgets/show-alert';
|
||||
import { snackBar } from '@/shared/lib';
|
||||
|
||||
export interface EscrowDetailProps {
|
||||
detailOn: boolean;
|
||||
@@ -87,7 +88,7 @@ export const EscrowDetail = ({
|
||||
setOrderNumber(rs.importantInfo?.orderNumber);
|
||||
}).catch((e: any) => {
|
||||
if(e.response?.data?.error?.message){
|
||||
showAlert(e.response?.data?.error?.message);
|
||||
snackBar(e.response?.data?.error?.message);
|
||||
return;
|
||||
}
|
||||
});
|
||||
@@ -117,7 +118,7 @@ export const EscrowDetail = ({
|
||||
console.log(rs);
|
||||
}).catch((e: any) => {
|
||||
if(e.response?.data?.error?.message){
|
||||
showAlert(e.response?.data?.error?.message);
|
||||
snackBar(e.response?.data?.error?.message);
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import moment from 'moment';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { SectionTitleArrow } from '@/entities/common/ui/section-title-arrow';
|
||||
import { useDownloadConfirmationMutation } from '../../api/use-download-confirmation-mutation';
|
||||
import { InfoSectionKeys, InfoSectionProps, TransactionCategory } from '../../model/types';
|
||||
import { CashReceiptReceiptDownloadParams, CashReceiptReceiptDownloadResponse, InfoSectionKeys, InfoSectionProps, TransactionCategory } from '../../model/types';
|
||||
import { SlideDown } from 'react-slidedown';
|
||||
import 'react-slidedown/lib/slidedown.css';
|
||||
import { showAlert } from '@/widgets/show-alert';
|
||||
import { snackBar } from '@/shared/lib';
|
||||
import { useCashReceiptReceiptDownloadMutation } from '../../api/use-cash-receipt-receipt-download-mutation';
|
||||
|
||||
export const AmountInfoSection = ({
|
||||
transactionCategory,
|
||||
@@ -18,7 +18,9 @@ export const AmountInfoSection = ({
|
||||
canDownloadReceipt
|
||||
}: InfoSectionProps) => {
|
||||
const { t } = useTranslation();
|
||||
const { mutateAsync: downloadConfirmation } = useDownloadConfirmationMutation();
|
||||
|
||||
const { mutateAsync: cashReceiptReceiptDownload } = useCashReceiptReceiptDownloadMutation();
|
||||
|
||||
let newAmountInfo: Record<string, any> | undefined = amountInfo;
|
||||
const subItems: Record<string, Record<string, string>> = {
|
||||
mid: {name: t('transaction.fields.mid'), type: 'string'},
|
||||
@@ -182,15 +184,17 @@ export const AmountInfoSection = ({
|
||||
}
|
||||
};
|
||||
|
||||
const onClickToDownloadConfirmation = () => {
|
||||
const onClickToDownload = () => {
|
||||
if(!!tid){
|
||||
downloadConfirmation({
|
||||
let params: CashReceiptReceiptDownloadParams = {
|
||||
tid: tid
|
||||
}).then((rs) => {
|
||||
};
|
||||
cashReceiptReceiptDownload(params).then((rs: CashReceiptReceiptDownloadResponse) => {
|
||||
console.log(rs);
|
||||
snackBar('거래확인서 다운 성공');
|
||||
}).catch((e: any) => {
|
||||
if(e.response?.data?.error?.message){
|
||||
showAlert(e.response?.data?.error?.message);
|
||||
snackBar(e.response?.data?.error?.message);
|
||||
return;
|
||||
}
|
||||
});
|
||||
@@ -395,7 +399,7 @@ export const AmountInfoSection = ({
|
||||
<button
|
||||
className="doc-btn"
|
||||
type="button"
|
||||
onClick={ () => onClickToDownloadConfirmation() }
|
||||
onClick={ () => onClickToDownload() }
|
||||
>{t('transaction.fields.transactionConfirmation')}</button>
|
||||
}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user