-부가서비스 MID 기준 SelectBox 처리 (추후 수정 가능)
- SMS 재발송 API 수정
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useState } from 'react';
|
||||
import { useState, useEffect } from 'react';
|
||||
import { PATHS } from '@/shared/constants/paths';
|
||||
import { useNavigate } from '@/shared/lib/hooks/use-navigate';
|
||||
import { HeaderType } from '@/entities/common/model/types';
|
||||
@@ -17,7 +17,7 @@ import { snackBar } from '@/shared/lib';
|
||||
export const AccountHolderSearchRequestPage = () => {
|
||||
const { navigate } = useNavigate();
|
||||
const userMid = useStore.getState().UserStore.mid;
|
||||
const midOptions = useStore.getState().UserStore.selectOptionsMids
|
||||
const midOptionsWithoutGids = useStore.getState().UserStore.selectOptionsMidsWithoutGids;
|
||||
const bankList = useStore.getState().CommonStore.bankList
|
||||
|
||||
useSetHeaderTitle('계좌성명조회 신청');
|
||||
@@ -30,11 +30,23 @@ export const AccountHolderSearchRequestPage = () => {
|
||||
const { mutateAsync: accountHolderSearchRequest } = useExtensionAccountHolderSearchRequestMutation();
|
||||
|
||||
const [formData, setFormData] = useState({
|
||||
mid: userMid,
|
||||
mid: '',
|
||||
bankCode: '',
|
||||
accountNo: ''
|
||||
})
|
||||
|
||||
// MID 초기값 설정
|
||||
useEffect(() => {
|
||||
if (!formData.mid && midOptionsWithoutGids.length > 0) {
|
||||
// userMid가 옵션에 있으면 userMid 사용, 없으면 첫 번째 옵션 사용
|
||||
const midItem = midOptionsWithoutGids.filter((value) => value.value === userMid);
|
||||
const initialMid = (midItem.length > 0) ? userMid : midOptionsWithoutGids[0]?.value || '';
|
||||
if (initialMid) {
|
||||
setFormData({ ...formData, mid: initialMid });
|
||||
}
|
||||
}
|
||||
}, [midOptionsWithoutGids, userMid]);
|
||||
|
||||
const handleInputChange = (field: string, value: string) => {
|
||||
setFormData({ ...formData, [field]: value });
|
||||
};
|
||||
@@ -62,8 +74,8 @@ export const AccountHolderSearchRequestPage = () => {
|
||||
.catch((error) => {
|
||||
console.error("계좌성명 조회 조회 신청 실패: ", error)
|
||||
const errorMessage = error?.response?.data?.error?.message ||
|
||||
error?.message ||
|
||||
'계좌성명 조회 신청 중 오류가 발생했습니다.';
|
||||
error?.message ||
|
||||
'계좌성명 조회 신청 중 오류가 발생했습니다.';
|
||||
snackBar(`[실패] ${errorMessage}`);
|
||||
})
|
||||
};
|
||||
@@ -88,7 +100,7 @@ export const AccountHolderSearchRequestPage = () => {
|
||||
<div className="billing-field">
|
||||
<select value={formData.mid} onChange={(e) => handleInputChange('mid', e.target.value)}>
|
||||
{
|
||||
midOptions.map((value) => (
|
||||
midOptionsWithoutGids.map((value) => (
|
||||
<option
|
||||
key={value.value}
|
||||
value={value.value}
|
||||
|
||||
@@ -26,9 +26,10 @@ import { snackBar } from '@/shared/lib';
|
||||
|
||||
export const AlimtalkSettingPage = () => {
|
||||
const { navigate } = useNavigate();
|
||||
const midOptionsWithoutGids = useStore.getState().UserStore.selectOptionsMidsWithoutGids;
|
||||
const userMid = useStore.getState().UserStore.mid;
|
||||
|
||||
const [mid, setMid] = useState<string>(userMid);
|
||||
const [mid, setMid] = useState<string>('');
|
||||
|
||||
const [merchantCardApprovalFlag, setMerchantCardApprovalFlag] = useState<boolean>(false);
|
||||
const [merchantCardCancelFlag, setMerchantCardCancelFlag] = useState<boolean>(false);
|
||||
@@ -122,9 +123,24 @@ export const AlimtalkSettingPage = () => {
|
||||
callSettingSave();
|
||||
};
|
||||
|
||||
// MID 초기값 설정
|
||||
useEffect(() => {
|
||||
callSettingDetail();
|
||||
}, []);
|
||||
if (!mid && midOptionsWithoutGids.length > 0) {
|
||||
// userMid가 옵션에 있으면 userMid 사용, 없으면 첫 번째 옵션 사용
|
||||
const midItem = midOptionsWithoutGids.filter((value) => value.value === userMid);
|
||||
const initialMid = (midItem.length > 0) ? userMid : midOptionsWithoutGids[0]?.value || '';
|
||||
if (initialMid) {
|
||||
setMid(initialMid);
|
||||
}
|
||||
}
|
||||
}, [midOptionsWithoutGids, userMid]);
|
||||
|
||||
// mid가 설정되면 설정 정보 불러오기
|
||||
useEffect(() => {
|
||||
if (mid) {
|
||||
callSettingDetail();
|
||||
}
|
||||
}, [mid]);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -141,8 +157,17 @@ export const AlimtalkSettingPage = () => {
|
||||
<div className="service-merchant">
|
||||
<div className="service-title">가맹점</div>
|
||||
<div className="service-select">
|
||||
<select>
|
||||
<option>nictest00m</option>
|
||||
<select
|
||||
value={mid}
|
||||
onChange={(e) => setMid(e.target.value)}>
|
||||
{
|
||||
midOptionsWithoutGids.map((value) => (
|
||||
<option
|
||||
key={value.value}
|
||||
value={value.value}
|
||||
>{value.name}</option>
|
||||
))
|
||||
}
|
||||
</select>
|
||||
<span className="ic20 arrow-down" aria-hidden="true"></span>
|
||||
</div>
|
||||
|
||||
@@ -77,7 +77,7 @@ export const FaceAuthPage = () => {
|
||||
|
||||
const callList = (type?: string) => {
|
||||
let listParams: ExtensionFaceAuthListParams = {
|
||||
mid: "faceauth0m",
|
||||
mid: mid,
|
||||
userMallId: userMallId,
|
||||
fromDate: fromDate,
|
||||
toDate: toDate,
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
useSetFooterMode,
|
||||
useSetOnBack
|
||||
} from '@/widgets/sub-layout/use-sub-layout';
|
||||
import { ChangeEvent, useState } from 'react';
|
||||
import { ChangeEvent, useState, useEffect } from 'react';
|
||||
import { ExtensionFundAccountTransferRegistParams, ExtensionFundAccountTransferRegistResponse } from '@/entities/additional-service/model/fund-account/types';
|
||||
import { useStore } from '@/shared/model/store';
|
||||
import { snackBar } from '@/shared/lib';
|
||||
@@ -18,11 +18,11 @@ import { useExtensionFundAccountTransferRequestMutation } from '@/entities/addit
|
||||
|
||||
export const FundAccountTransferRequestPage = () => {
|
||||
const { navigate } = useNavigate();
|
||||
const midOptions = useStore.getState().UserStore.selectOptionsMids;
|
||||
const midOptionsWithoutGids = useStore.getState().UserStore.selectOptionsMidsWithoutGids;
|
||||
const userMid = useStore.getState().UserStore.mid;
|
||||
const bankList = useStore.getState().CommonStore.bankList;
|
||||
|
||||
const [mid, setMid] = useState<string>(userMid);
|
||||
const [mid, setMid] = useState<string>('');
|
||||
const [bankCode, setBankCode] = useState<string>('');
|
||||
const [accountNo, setAccountNo] = useState<string>('');
|
||||
const [accountName, setAccountName] = useState<string>('');
|
||||
@@ -39,6 +39,18 @@ export const FundAccountTransferRequestPage = () => {
|
||||
navigate(PATHS.additionalService.fundAccount.transferList);
|
||||
});
|
||||
|
||||
// MID 초기값 설정
|
||||
useEffect(() => {
|
||||
if (!mid && midOptionsWithoutGids.length > 0) {
|
||||
// userMid가 옵션에 있으면 userMid 사용, 없으면 첫 번째 옵션 사용
|
||||
const midItem = midOptionsWithoutGids.filter((value) => value.value === userMid);
|
||||
const initialMid = (midItem.length > 0) ? userMid : midOptionsWithoutGids[0]?.value || '';
|
||||
if (initialMid) {
|
||||
setMid(initialMid);
|
||||
}
|
||||
}
|
||||
}, [midOptionsWithoutGids, userMid]);
|
||||
|
||||
const resetForm = () => {
|
||||
setBankCode('');
|
||||
setAccountNo('');
|
||||
@@ -68,8 +80,8 @@ export const FundAccountTransferRequestPage = () => {
|
||||
}
|
||||
}).catch((error) => {
|
||||
const errorMessage = error?.response?.data?.error?.message ||
|
||||
error?.message ||
|
||||
'이체등록 중 오류가 발생했습니다.';
|
||||
error?.message ||
|
||||
'이체등록 중 오류가 발생했습니다.';
|
||||
snackBar(`[실패] ${errorMessage}`);
|
||||
});
|
||||
};
|
||||
@@ -96,9 +108,11 @@ export const FundAccountTransferRequestPage = () => {
|
||||
<div className="billing-row">
|
||||
<div className="billing-label">가맹점<span>*</span></div>
|
||||
<div className="billing-field">
|
||||
<select value={mid} onChange={(e) => setMid(e.target.value)}>
|
||||
<select
|
||||
value={mid}
|
||||
onChange={(e) => setMid(e.target.value)}>
|
||||
{
|
||||
midOptions.map((value) => (
|
||||
midOptionsWithoutGids.map((value) => (
|
||||
<option
|
||||
key={value.value}
|
||||
value={value.value}
|
||||
|
||||
@@ -15,10 +15,19 @@ import moment from 'moment';
|
||||
|
||||
export const LinkPaymentApplyPage = () => {
|
||||
const { navigate } = useNavigate();
|
||||
|
||||
const midOptionsWithoutGids = useStore.getState().UserStore.selectOptionsMidsWithoutGids;
|
||||
const userMid = useStore.getState().UserStore.mid;
|
||||
|
||||
// userMid가 midOptionsWithoutGids에 있으면 userMid 사용, 없으면 첫 번째 옵션 사용
|
||||
let midItem = midOptionsWithoutGids.filter((value) => {
|
||||
return value.value === userMid;
|
||||
});
|
||||
const initialMid = (midItem.length > 0) ? userMid : (midOptionsWithoutGids.length > 0 ? midOptionsWithoutGids[0]?.value || '' : '');
|
||||
|
||||
const [processStep, setProcessStep] = useState<ProcessStep>(ProcessStep.One);
|
||||
const [formData, setFormData] = useState<LinkPaymentFormData>({
|
||||
mid: userMid,
|
||||
mid: initialMid,
|
||||
sendMethod: LinkPaymentSendMethod.SMS,
|
||||
goodsName: '',
|
||||
amount: 0,
|
||||
|
||||
Reference in New Issue
Block a user