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();