([]);
diff --git a/src/pages/Seller/SellerAccountSetting.tsx b/src/pages/Seller/SellerAccountSetting.tsx
index 8ae63963..1e7519e1 100644
--- a/src/pages/Seller/SellerAccountSetting.tsx
+++ b/src/pages/Seller/SellerAccountSetting.tsx
@@ -30,10 +30,10 @@ function SellerAccountSetting() {
{
- navigate('/minder/refundBankAccount');
+ navigate('/minder/profitBankAccount');
}}
>
- 환불계좌 관리
+ 수익계좌 관리
('');
- const [bankType, setBankType] = useState(null);
- const [owner, setOwner] = useState('');
+ const [bankType, setBankType] = useState('');
+ const [owner, setOwner] = useState('');
+
+ // 완료버튼 활성화 여부
+ const isActiveFinishButton =
+ accountNum?.length > 0 && bankType?.length > 0 && owner?.length > 0;
+
// 은행 모달
const [isBankModalOpen, setIsBankModalOpen] =
useRecoilState(isBankModalOpenState);
- const [isActiveFisnishButton, setIsActiveFinishButton] = useState(false);
useEffect(() => {
const fetchAccountData = async () => {
try {
@@ -41,32 +47,35 @@ function SellerRefundBankAccount() {
};
fetchAccountData();
}, []);
- useEffect(() => {
- if (accountNum !== '' && bankType !== '' && owner !== '') {
- setIsActiveFinishButton(true);
- } else {
- setIsActiveFinishButton(false);
- }
- }, [accountNum, bankType, owner]);
- const handleAccountNumChange = (e: React.ChangeEvent) => {
- const value = e.target.value;
- const sanitizedValue = value.replace(/[^0-9]/g, '');
- setAccountNum(sanitizedValue);
- };
+ const handleAccountNumChange = useCallback(
+ (e: React.ChangeEvent) => {
+ const value = e.target.value;
+ const sanitizedValue = value.replace(/[^0-9]/g, '');
+ setAccountNum(sanitizedValue);
+ },
+ [],
+ );
- const handlePostAccountInfo = async () => {
- // 임시조건
+ const handlePostAccountInfo = useCallback(async () => {
if (accountNum !== '' && bankType !== '' && owner !== '') {
const body = {
account: accountNum,
bank: bankType,
accountHolder: owner,
};
- await patchCounselorsAccount(body);
- navigate('/minder/mypage');
+ try {
+ const res: any = await patchCounselorsAccount(body);
+ if (res.status === 200) {
+ navigate('/minder/mypage');
+ } else {
+ alert('수익계좌 업데이트 중 오류가 발생했습니다.');
+ }
+ } catch (err) {
+ alert(err);
+ }
}
- };
+ }, [accountNum, bankType, owner, navigate]);
return (
@@ -76,7 +85,7 @@ function SellerRefundBankAccount() {
navigate('/minder/setting');
}}
/>
- 환불계좌 관리
+ 수익계좌 관리