From cc2016282ba56fcea47d2dba0cff5036b25f3752 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=83=81=ED=98=84?= Date: Fri, 23 Feb 2024 13:57:05 +0900 Subject: [PATCH] =?UTF-8?q?=ED=9A=8C=EC=9B=90=EA=B0=80=EC=9E=85=20?= =?UTF-8?q?=EC=97=90=EB=9F=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../account/register/AccountRegisterForm.js | 17 ++++++++++------- .../features/account/register/registerThunk.ts | 18 ++++++++++++------ 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/components/account/register/AccountRegisterForm.js b/src/components/account/register/AccountRegisterForm.js index ab7783fd..c0f4efde 100644 --- a/src/components/account/register/AccountRegisterForm.js +++ b/src/components/account/register/AccountRegisterForm.js @@ -15,12 +15,15 @@ import { Button, FormGroup } from '@component/ui'; +import { Button as ConfirmButton } from 'reactstrap'; import { confirmCrtfyhp, sendCrtfyhp } from '@src/redux/features/account/register/registerThunk'; import { openModal } from '@src/redux/features/comn/message/messageSlice'; import { MODAL_CRTFYHP, MODAL_BODY, MODAL_HEADER } from '@src/configs/msgConst'; +import { CgKey } from 'react-icons/cg'; +import { createRegister } from '@src/redux/features/account/register/registerThunk'; export const AccountRegisterForm = ({ stepper, @@ -211,22 +214,22 @@ export const AccountRegisterForm = ({ }, resolver: yupResolver(SignupSchema) }); - // 취소 헨들러 const handlerCancel = async () => { movePage('/account/login'); }; // 회원가입 버튼 헨들러 - const onSubmit = async data => { + const onSubmit = async rq => { if (isObjEmpty(errors)) { if (!isCrtfy) { handlerOpenModal('회원가입 실패', '휴대폰 인증을 진행해주세요.'); return false; } - const { payload: data } = await dispatch(register({ data, agreeTerms })); - if (data?.errCode === -1) { + const data = await dispatch(createRegister({ ...rq, terms: agreeTerms })); + + if (data?.payload.errCode === -1) { handlerOpenModal( '회원가입 실패', '동일한 아이디가 존재합니다. 다른 아이디로 가입 신청해주세요.' @@ -234,7 +237,7 @@ export const AccountRegisterForm = ({ return; } - if (data?.errCode === 1) { + if (data?.payload.errCode === 1) { stepper.next(); } else { handlerOpenModal('회원가입 실패', '회원 가입에 실패하였습니다.'); @@ -659,9 +662,9 @@ export const AccountRegisterForm = ({ > 취소 - + diff --git a/src/redux/features/account/register/registerThunk.ts b/src/redux/features/account/register/registerThunk.ts index df0151ec..cf8248b5 100644 --- a/src/redux/features/account/register/registerThunk.ts +++ b/src/redux/features/account/register/registerThunk.ts @@ -10,18 +10,24 @@ import { MODAL_BODY, MODAL_HEADER } from '@src/configs/msgConst'; import { DefaultSearchModel } from '@src/utility/ComnModel'; // 회원가입 -export const register = createAsyncThunk( +export const createRegister = createAsyncThunk( 'account/register', async (rq: IRegisterRq, thunkAPI) => { try { const param = { - ...rq.data, - ...ACCOUNT, - terms: rq.agreeTerms + ...rq, + ...ACCOUNT }; - const { data } = await axios.post('api/acnt/cstmr/register', param); - if (data.errorCode > 0) { + const { + data + }: { + data: { + errCode: number; + }; + } = await axios.post('api/acnt/cstmr/register', param); + + if (data.errCode > 0) { return data; } else { throw new Error();