Browse Source

[Redux] /account/register 미사용 코드 제거 및 경로 변경

master
junh_eee(이준희) 8 months ago
parent
commit
592f189f3a
  1. 4
      src/components/account/find/AccountFindPassword.js
  2. 4
      src/components/account/find/AccountFindUserId.js
  3. 8
      src/components/account/register/AccountRegisterForm.js
  4. 2
      src/components/account/register/AccountRegisterTerm.js
  5. 2
      src/components/laanc/list/LaancDetail.js
  6. 2
      src/components/laanc/step/LaancStep2.js
  7. 6
      src/containers/account/mypage/AccountMypageContainer.js
  8. 19
      src/modules/account/register/actions/index.ts
  9. 37
      src/modules/account/register/apis/index.ts
  10. 9
      src/modules/account/register/index.ts
  11. 10
      src/modules/account/register/models/index.ts
  12. 18
      src/modules/account/register/reducers/index.ts
  13. 22
      src/modules/account/register/sagas/index.ts

4
src/components/account/find/AccountFindPassword.js

@ -16,7 +16,7 @@ import {
} from '../../ui/index';
import { User, Lock } from 'react-feather';
import '../../../assets/css/custom.css';
import { accountApi } from '../../../modules/account/register/apis/accountApi';
import { accountAPI } from '../../../modules/account/register';
import { findAPI, updatePwAction } from '../../../modules/account/find';
export const AccountFindPassword = props => {
@ -203,7 +203,7 @@ export const AccountFindPassword = props => {
return;
}
const res = await accountApi.crtfyhpConfirm(inputHpno, inputCrtfy);
const res = await accountAPI.crtfyhpConfirm(inputHpno, inputCrtfy);
if (!res.data.result) {
setModal({
isOpen: true,

4
src/components/account/find/AccountFindUserId.js

@ -17,7 +17,7 @@ import {
import { User } from 'react-feather';
import '../../../assets/css/custom.css';
import { accountApi } from '../../../modules/account/register/apis/accountApi';
import { accountAPI } from '../../../modules/account/register';
import { findAPI, findUserIdAction } from '../../../modules/account/find';
export const AccountFindUserId = props => {
@ -208,7 +208,7 @@ export const AccountFindUserId = props => {
return;
}
const res = await accountApi.crtfyhpConfirm(inputHpno, inputCrtfy);
const res = await accountAPI.crtfyhpConfirm(inputHpno, inputCrtfy);
if (!res.data.result) {
setModal({
isOpen: true,

8
src/components/account/register/AccountRegisterForm.js

@ -19,7 +19,7 @@ import {
FormFeedback
} from '../../ui/index';
import { useDispatch, useSelector } from 'react-redux';
import { accountApi } from '../../../modules/account/register/apis/accountApi';
import { accountAPI } from '../../../modules/account/register';
export const AccountRegisterForm = ({
stepper,
@ -110,7 +110,7 @@ export const AccountRegisterForm = ({
return;
}
const res = await accountApi.crtfyhp(vData.hpno);
const res = await accountAPI.crtfyhp(vData.hpno);
if (!res.data.result) {
if (res.data.code === -1) {
@ -237,7 +237,7 @@ export const AccountRegisterForm = ({
// dispatch(
// Actions.register.request({ data: data, agreeTerms: agreeTerms })
// );
const res = await accountApi.register({
const res = await accountAPI.register({
data: data,
agreeTerms: agreeTerms
});
@ -286,7 +286,7 @@ export const AccountRegisterForm = ({
return false;
}
const res = await accountApi.crtfyhpConfirm(vData.hpno, vData.crtfyNo);
const res = await accountAPI.crtfyhpConfirm(vData.hpno, vData.crtfyNo);
if (!res.data.result) {
setModal({

2
src/components/account/register/AccountRegisterTerm.js

@ -11,7 +11,7 @@ import {
ModalFooter
} from '../../ui/index';
import { useDispatch, useSelector } from 'react-redux';
import * as Actions from '../../../modules/account/register/actions/accountAction';
import * as Actions from '../../../modules/account/register';
export const AccountRegisterTerm = ({ stepper, type, movePage }) => {
// 약관 목록

2
src/components/laanc/list/LaancDetail.js

@ -12,7 +12,7 @@ import {
Input
} from '../../ui/index';
import FlightArea from '../map/FlightArea';
import * as TermsActions from '../../../modules/account/register/actions/accountAction';
import * as TermsActions from '../../../modules/account/register';
export default function LaancDetail({ data, handlerLaancClose }) {
const dispatch = useDispatch();

2
src/components/laanc/step/LaancStep2.js

@ -17,7 +17,7 @@ import {
CustomInput
} from '../../ui/index';
import * as LaancAction from '../../../modules/laanc/actions/laancActions';
import * as TermsActions from '../../../modules/account/register/actions/accountAction';
import * as TermsActions from '../../../modules/account/register';
const FlightArea = lazy(() => import('../map/FlightArea'));

6
src/containers/account/mypage/AccountMypageContainer.js

@ -15,7 +15,7 @@ import {
ModalBody,
ModalFooter
} from 'reactstrap';
import { accountApi } from '../../../modules/account/register/apis/accountApi';
import { accountAPI } from '../../../modules/account/register';
import AccountMypagePwForm from '../../../components/account/mypage/AccountMypagePwForm';
import AccountMypageForm from '../../../components/account/mypage/AccountMypageForm';
import {
@ -157,7 +157,7 @@ const AccountMypageContainer = () => {
return;
}
const res = await accountApi.crtfyhp(inputHpno);
const res = await accountAPI.crtfyhp(inputHpno);
if (!res.data.result) {
if (res.data.code === -1) {
@ -233,7 +233,7 @@ const AccountMypageContainer = () => {
return false;
}
const res = await accountApi.crtfyhpConfirm(inputHpno, inputCrtfy);
const res = await accountAPI.crtfyhpConfirm(inputHpno, inputCrtfy);
if (!res.data.result) {
setModal({

19
src/modules/account/register/actions/accountAction.ts → src/modules/account/register/actions/index.ts

@ -1,32 +1,21 @@
import { AxiosError } from 'axios';
import { createAsyncAction, ActionType, createAction } from 'typesafe-actions';
import { DefaultSeachModel } from '../../../models/ComnModel';
import {
AccountData,
AccountTermsData,
AccountState,
AccountFormData,
AgreeTermsData
} from '../models/accountModel';
import { AccountTermsData, AccountFormData, AgreeTermsData } from '../models';
// 회원가입
const REGISTER_REQUEST = 'account/register/REGISTER_REQUEST';
const REGISTER_SUCCESS = 'account/register/REGISTER_SUCCESS';
const REGISTER_FAILURE = 'account/register/REGISTER_FAILURE';
// 약관 체크 목록
const TERMS_DISPATCH = 'account/terms/TERMS_DISPATCH';
// 약관 리스트
const TERMS_REQUEST = 'account/terms/TERMS_REQUEST';
const TERMS_SUCCESS = 'account/terms/TERMS_SUCCESS';
const TERMS_FAILURE = 'account/terms/TERMS_FAILURE';
// const CRTFYHP_REQUEST = 'account/crtfyhp/CRTFYHP_REQUEST';
// const CRTFYHP_SUCCESS = 'account/crtfyhp/CRTFYHP_SUCCESS';
// const CRTFYHP_FAILURE = 'account/crtfyhp/CRTFYHP_FAILURE';
// const CRTFYHP_CONFIRM_REQUEST = 'account/crtfyhp/CRTFYHP_REQUEST';
// const CRTFYHP_CONFIRM_SUCCESS = 'account/crtfyhp/CRTFYHP_REQUEST';
// const CRTFYHP_CONFIRM_FAILURE = 'account/crtfyhp/CRTFYHP_REQUEST';
export const register = createAsyncAction(
REGISTER_REQUEST,
REGISTER_SUCCESS,

37
src/modules/account/register/apis/accountApi.ts → src/modules/account/register/apis/index.ts

@ -1,12 +1,12 @@
import axios from '../../../utils/customAxiosUtil';
import qs from 'qs';
import { AccountFormData, AccountState } from '../models/accountModel';
import { AccountFormData } from '../models';
import { DefaultSeachModel } from '../../../models/ComnModel';
import { ACCOUNT } from '../../../../configs/constants';
// import { ReponseControlGpHistory } from '../models/controlGpModel';
export const accountApi = {
export const accountAPI = {
// 회원가입
register: async (data: AccountFormData) => {
const param = {
...data.data,
@ -16,7 +16,7 @@ export const accountApi = {
const res = await axios.post('api/acnt/cstmr/register', param);
return res;
},
// 약관 목록
temrsList: async (param: DefaultSeachModel) => {
const queryString = qs.stringify(param, {
addQueryPrefix: true,
@ -24,39 +24,14 @@ export const accountApi = {
});
return await axios.get(`api/acnt/terms/list` + queryString);
},
// 인증번호 발송
crtfyhp: async (hpno: string) => {
return await axios.get(`api/acnt/crtfyhp/register/send?hpno=${hpno}`);
``;
},
// 인증번호 확인
crtfyhpConfirm: async (hpno: string, crtfyNo: string) => {
return await axios.get(
`api/acnt/crtfyhp/register/confirm?hpno=${hpno}&crtfyNo=${crtfyNo}`
);
}
// list: async (data: string) => {
// const queryString = qs.stringify(data, {
// addQueryPrefix: true,
// arrayFormat: 'repeat'
// });
// return await axios.get(`/api/anls/hstry/list` + queryString);
// },
// detail: async (id: string) => {
// return await axios.get(`/api/anls/hstry/detail/${id}`);
// },
// log: async (id: string) => {
// return await axios.get(`/api/anls/hstry/log/${id}`);
// }
// getHistory: async (id: string) => {
// if (!id) {
// return null;
// }
// const { data }: ReponseControlGpHistory = await axios.get(
// `api/ctr/cntrl/history/${id}`
// );
// return data;
// }
};

9
src/modules/account/register/index.ts

@ -1,4 +1,5 @@
export * from './actions/accountAction';
export * from './models/accountModel';
export * from './reducers/accountReducer';
export * from './sagas/accountSaga';
export * from './actions';
export * from './apis';
export * from './models';
export * from './reducers';
export * from './sagas';

10
src/modules/account/register/models/accountModel.ts → src/modules/account/register/models/index.ts

@ -1,11 +1,3 @@
// export interface AccountListState {
// data: AnalysisHistoryData[] | undefined;
// detail: AnalysisHistoryData | undefined;
// log: AnalysisHistoryLogData[] | undefined;
// count: number | 0;
// params: string;
// }
export interface AccountState {
data: AccountData | undefined;
agreeTerms: AgreeTermsData[] | undefined;
@ -54,7 +46,7 @@ export interface AccountTermsData {
simpleCn: string;
}
export const initResponseAccountData = {
export const initResponseAccountData: AccountState = {
data: undefined,
agreeTerms: undefined,
termsList: undefined,

18
src/modules/account/register/reducers/accountReducer.ts → src/modules/account/register/reducers/index.ts

@ -1,36 +1,22 @@
import { createReducer } from 'typesafe-actions';
import produce from 'immer';
import * as Actions from '../actions/accountAction';
import {
initResponseAccountData,
AccountData,
AccountState
} from '../models/accountModel';
import * as Actions from '../actions';
import { initResponseAccountData, AccountState } from '../models';
export const accountReducer = createReducer<
AccountState,
Actions.AccountAction
>(initResponseAccountData)
// .handleAction(Actions.register.success, (state, action) =>
// produce(state, draft => {
// const res = action.payload;
// })
// )
.handleAction(Actions.agreeTerms, (state, action) =>
produce(state, draft => {
const res = action.payload;
draft.agreeTerms = res;
// draft.terms = res;
})
)
.handleAction(Actions.termsList.success, (state, action) =>
produce(state, draft => {
const res = action.payload;
draft.termsList = res;
// draft.terms = res;
})
);

22
src/modules/account/register/sagas/accountSaga.ts → src/modules/account/register/sagas/index.ts

@ -1,21 +1,15 @@
import {
call,
put,
select,
takeEvery,
takeLatest
} from '@redux-saga/core/effects';
import { call, put, takeEvery } from '@redux-saga/core/effects';
import { ActionType } from 'typesafe-actions';
import * as Actions from '../actions/accountAction';
import * as Apis from '../apis/accountApi';
import * as Models from '../models/accountModel';
import * as Actions from '../actions';
import * as Apis from '../apis';
import * as Models from '../models';
function* register(action: ActionType<typeof Actions.register.request>) {
try {
const { data, agreeTerms } = action.payload;
const res = yield call(Apis.accountApi.register, { data, agreeTerms });
const res = yield call(Apis.accountAPI.register, { data, agreeTerms });
const resData = res.data;
@ -24,7 +18,7 @@ function* register(action: ActionType<typeof Actions.register.request>) {
} else {
yield put(Actions.register.failure(resData));
}
} catch (error) {
} catch (error: any) {
yield put(Actions.register.failure(error));
// yield put(Actions.createNoticeAction.failure(error));
}
@ -34,7 +28,7 @@ function* temrsList(action: ActionType<typeof Actions.termsList.request>) {
try {
const { langDivCd, siteCd, termsCtgryCd } = action.payload;
const res = yield call(Apis.accountApi.temrsList, {
const res = yield call(Apis.accountAPI.temrsList, {
langDivCd,
siteCd,
termsCtgryCd
@ -43,7 +37,7 @@ function* temrsList(action: ActionType<typeof Actions.termsList.request>) {
const resData: Models.AccountTermsData[] = res.data;
yield put(Actions.termsList.success(resData));
} catch (error) {
} catch (error: any) {
yield put(Actions.termsList.failure(error));
// yield put(Actions.createNoticeAction.failure(error));
}
Loading…
Cancel
Save