Browse Source

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

master
junh_eee(이준희) 8 months ago
parent
commit
f36bb5efa6
  1. 3
      src/components/account/find/AccountFindPassword.js
  2. 3
      src/components/account/find/AccountFindUserId.js
  3. 19
      src/modules/account/find/actions/index.ts
  4. 21
      src/modules/account/find/apis/findApi.ts
  5. 31
      src/modules/account/find/apis/index.ts
  6. 8
      src/modules/account/find/index.ts
  7. 19
      src/modules/account/find/models/findModel.ts
  8. 55
      src/modules/account/find/reducers/findReducer.ts
  9. 55
      src/modules/account/find/reducers/index.ts
  10. 37
      src/modules/account/find/sagas/index.ts
  11. 1
      src/modules/basis/dron/index.ts
  12. 1
      src/modules/basis/group/index.ts

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

@ -16,9 +16,8 @@ import {
} from 'reactstrap';
import { User, Lock } from 'react-feather';
import '../../../assets/css/custom.css';
import { findAPI } from '../../../modules/account/find/apis/findApi';
import { accountApi } from '../../../modules/account/register/apis/accountApi';
import { updatePwAction } from '../../../modules/account/find/actions/findAction';
import { findAPI, updatePwAction } from '../../../modules/account/find';
export const AccountFindPassword = props => {
const dispatch = useDispatch();

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

@ -17,9 +17,8 @@ import {
import { User } from 'react-feather';
import '../../../assets/css/custom.css';
import { findUserIdAction } from '../../../modules/account/find/actions/findAction';
import { accountApi } from '../../../modules/account/register/apis/accountApi';
import { findAPI } from '../../../modules/account/find/apis/findApi';
import { findAPI, findUserIdAction } from '../../../modules/account/find';
export const AccountFindUserId = props => {
const dispatch = useDispatch();

19
src/modules/account/find/actions/findAction.ts → src/modules/account/find/actions/index.ts

@ -1,46 +1,49 @@
import { AxiosError } from 'axios';
import { string } from 'prop-types';
import { ActionType, createAsyncAction } from 'typesafe-actions';
// 아이디 찾기 인증번호 발송
const SEND_FORID_REQUEST = 'find/SEND_FORID_REQUEST';
const SEND_FORID_SUCCESS = 'find/SEND_FORID_SUCCESS';
const SEND_FORID_FAILURE = 'find/SEND_FORID_FAILURE';
// 아이디 찾기
const FIND_USERID_REQUEST = 'find/FIND_USERID_REQUEST';
const FIND_USERID_SUCCESS = 'find/FIND_USERID_SUCCESS';
const FIND_USERID_FAILURE = 'find/FIND_USERID_FAILURE';
// 비밀번호 찾기 인증번호 발송
const SEND_FORPW_REQUEST = 'find/SEND_FORPW_REQUEST';
const SEND_FORPW_SUCCESS = 'find/SEND_FORPW_SUCCESS';
const SEND_FORPW_FAILURE = 'find/SEND_FORPW_FAILURE';
const UPDATE_USERPW_REQUEST = 'find/UPDATE_USERPW_REQUEST'
const UPDATE_USERPW_SUCCESS = 'find/UPDATE_USERPW_SUCCESS'
const UPDATE_USERPW_FAILURE = 'find/UPDATE_USERPW_FAILURE'
// 비밀번호 변경
const UPDATE_USERPW_REQUEST = 'find/UPDATE_USERPW_REQUEST';
const UPDATE_USERPW_SUCCESS = 'find/UPDATE_USERPW_SUCCESS';
const UPDATE_USERPW_FAILURE = 'find/UPDATE_USERPW_FAILURE';
export const sendForIdAction = createAsyncAction(
SEND_FORID_REQUEST,
SEND_FORID_SUCCESS,
SEND_FORID_FAILURE
)<{memberName: string, hpno: string}, string, AxiosError>();
)<{ memberName: string; hpno: string }, string, AxiosError>();
export const findUserIdAction = createAsyncAction(
FIND_USERID_REQUEST,
FIND_USERID_SUCCESS,
FIND_USERID_FAILURE
)<{memberName: string, hpno: string}, string, AxiosError>();
)<{ memberName: string; hpno: string }, string, AxiosError>();
export const sendForPwAction = createAsyncAction(
SEND_FORPW_REQUEST,
SEND_FORPW_SUCCESS,
SEND_FORPW_FAILURE
)<{userId: string, hpno: string}, string, AxiosError>();
)<{ userId: string; hpno: string }, string, AxiosError>();
export const updatePwAction = createAsyncAction(
UPDATE_USERPW_REQUEST,
UPDATE_USERPW_SUCCESS,
UPDATE_USERPW_FAILURE
)<{userId: string, hpno: string, newPw: string}, string, AxiosError>();
)<{ userId: string; hpno: string; newPw: string }, string, AxiosError>();
const actions = {
sendForIdAction,

21
src/modules/account/find/apis/findApi.ts

@ -1,21 +0,0 @@
import axios from '../../../utils/customAxiosUtil';
import qs from 'qs';
export const findAPI = {
sendForId: async(param) => {
return await axios.get(`api/acnt/crtfyhp/find/sendForId?memberName=${param.memberName}&hpno=${param.hpno}`);
},
getUserId: async(param) => {
return await axios.get(`api/acnt/crtfyhp/find/findUserId?memberName=${param.memberName}&hpno=${param.hpno}`);
},
sendForPw: async(param) => {
return await axios.get(`api/acnt/crtfyhp/find/sendForPw?userId=${param.userId}&hpno=${param.hpno}`);
},
updatePw: async(param) => {
return await axios.get(`api/acnt/crtfyhp/find/updatePw?userId=${param.userId}&hpno=${param.hpno}&newPw=${param.newPw}`);
}
}

31
src/modules/account/find/apis/index.ts

@ -0,0 +1,31 @@
import axios from '../../../utils/customAxiosUtil';
export const findAPI = {
// 아이디 찾기 인증번호 발송
sendForId: async param => {
return await axios.get(
`api/acnt/crtfyhp/find/sendForId?memberName=${param.memberName}&hpno=${param.hpno}`
);
},
// 아이디 찾기
getUserId: async param => {
return await axios.get(
`api/acnt/crtfyhp/find/findUserId?memberName=${param.memberName}&hpno=${param.hpno}`
);
},
// 비밀번호 찾기 인증번호 발송
sendForPw: async param => {
return await axios.get(
`api/acnt/crtfyhp/find/sendForPw?userId=${param.userId}&hpno=${param.hpno}`
);
},
// 비밀번호 변경
updatePw: async param => {
return await axios.get(
`api/acnt/crtfyhp/find/updatePw?userId=${param.userId}&hpno=${param.hpno}&newPw=${param.newPw}`
);
}
};

8
src/modules/account/find/index.ts

@ -1,4 +1,4 @@
export * from './actions/findAction';
export * from './models/findModel';
export * from './reducers/findReducer';
export * from './sagas/findSaga';
export * from './actions';
export * from './apis';
export * from './reducers';
export * from './sagas';

19
src/modules/account/find/models/findModel.ts

@ -1,19 +0,0 @@
export interface AccountFindState {
accountFind: AccountFindData | undefined;
}
export interface AccountFindData {
cstmrSno: number;
userId: string;
memberName: string;
hpno: string;
cntfyhpNo: string;
crtfyhpYn: string;
}
export interface IsCntfyhpSend {
}
export const initResponseFindData = {
accountFind: undefined
}

55
src/modules/account/find/reducers/findReducer.ts

@ -1,55 +0,0 @@
// base
import produce from 'immer';
import { createReducer } from 'typesafe-actions';
// action
import {
FindAction,
findUserIdAction,
sendForIdAction,
sendForPwAction,
updatePwAction
} from '../actions/findAction';
//
export interface findState {
idResult: string | undefined;
userId: string | undefined;
pwResult: string | undefined;
udResult: string | undefined;
}
const initFindState : findState = {
idResult: undefined,
userId: undefined,
pwResult: undefined,
udResult: undefined
}
export const findAccountReducer = createReducer<findState, FindAction>(
initFindState
).handleAction(sendForIdAction.success, (state, action) =>
produce(state, draft => {
const data = action.payload;
draft.idResult = data;
})
).handleAction(findUserIdAction.success, (state, action) =>
produce(state, draft => {
const data = action.payload;
draft.userId = data;
})
).handleAction(sendForPwAction.success, (state, action) =>
produce(state, draft => {
const data = action.payload;
draft.pwResult = data;
})
).handleAction(updatePwAction.success, (state, action) =>
produce(state, draft => {
const data = action.payload;
draft.udResult = data;
})
)

55
src/modules/account/find/reducers/index.ts

@ -0,0 +1,55 @@
// base
import produce from 'immer';
import { createReducer } from 'typesafe-actions';
// action
import {
FindAction,
findUserIdAction,
sendForIdAction,
sendForPwAction,
updatePwAction
} from '../actions';
//
export interface findState {
idResult: string | undefined;
userId: string | undefined;
pwResult: string | undefined;
udResult: string | undefined;
}
const initFindState: findState = {
idResult: undefined,
userId: undefined,
pwResult: undefined,
udResult: undefined
};
export const findAccountReducer = createReducer<findState, FindAction>(
initFindState
)
.handleAction(sendForIdAction.success, (state, action) =>
produce(state, draft => {
const data = action.payload;
draft.idResult = data;
})
)
.handleAction(findUserIdAction.success, (state, action) =>
produce(state, draft => {
const data = action.payload;
draft.userId = data;
})
)
.handleAction(sendForPwAction.success, (state, action) =>
produce(state, draft => {
const data = action.payload;
draft.pwResult = data;
})
)
.handleAction(updatePwAction.success, (state, action) =>
produce(state, draft => {
const data = action.payload;
draft.udResult = data;
})
);

37
src/modules/account/find/sagas/findSaga.ts → src/modules/account/find/sagas/index.ts

@ -2,19 +2,18 @@ import { call, put, takeEvery } from 'redux-saga/effects';
// packages
import { ActionType } from 'typesafe-actions';
// modules
import * as Actions from '../actions/findAction';
import { findAPI } from '../apis/findApi';
import * as Actions from '../actions';
import { findAPI } from '../apis';
function* sendForIdSaga(
action: ActionType<typeof Actions.sendForIdAction.request>
) {
try{
const {memberName, hpno} = action.payload;
try {
const { memberName, hpno } = action.payload;
const res = yield call(findAPI.sendForId, { memberName, hpno });
yield put(Actions.sendForIdAction.success(res));
} catch (error) {
} catch (error: any) {
yield put(Actions.sendForIdAction.failure(error));
}
}
@ -22,12 +21,12 @@ function* sendForIdSaga(
function* findUserIdSaga(
action: ActionType<typeof Actions.findUserIdAction.request>
) {
try{
const {memberName, hpno} = action.payload;
try {
const { memberName, hpno } = action.payload;
const res = yield call(findAPI.getUserId, { memberName, hpno });
yield put(Actions.findUserIdAction.success(res));
} catch (error) {
} catch (error: any) {
yield put(Actions.findUserIdAction.failure(error));
}
}
@ -35,12 +34,12 @@ function* findUserIdSaga(
function* sendForPwSaga(
action: ActionType<typeof Actions.sendForPwAction.request>
) {
try{
const {userId, hpno} = action.payload;
try {
const { userId, hpno } = action.payload;
const res = yield call(findAPI.sendForPw, {userId, hpno});
const res = yield call(findAPI.sendForPw, { userId, hpno });
yield put(Actions.sendForPwAction.success(res));
} catch (error) {
} catch (error: any) {
yield put(Actions.sendForPwAction.failure(error));
}
}
@ -48,12 +47,12 @@ function* sendForPwSaga(
function* updatePwSaga(
action: ActionType<typeof Actions.updatePwAction.request>
) {
try{
const {userId, hpno, newPw} = action.payload;
try {
const { userId, hpno, newPw } = action.payload;
const res = yield call(findAPI.updatePw, {userId, hpno, newPw});
const res = yield call(findAPI.updatePw, { userId, hpno, newPw });
yield put(Actions.updatePwAction.success(res));
} catch (error) {
} catch (error: any) {
yield put(Actions.updatePwAction.failure(error));
}
}
@ -63,4 +62,4 @@ export function* findSaga() {
yield takeEvery(Actions.findUserIdAction.request, findUserIdSaga);
yield takeEvery(Actions.sendForPwAction.request, sendForPwSaga);
yield takeEvery(Actions.updatePwAction.request, updatePwSaga);
}
}

1
src/modules/basis/dron/index.ts

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

1
src/modules/basis/group/index.ts

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

Loading…
Cancel
Save