From cfad9d66ce41d5db0efc873cf6b2a6e426ce0318 Mon Sep 17 00:00:00 2001 From: sanguu Date: Fri, 23 Sep 2022 10:37:17 +0900 Subject: [PATCH] =?UTF-8?q?=ED=9A=8C=EC=9B=90=ED=83=88=ED=87=B4=20?= =?UTF-8?q?=EB=AC=B8=EA=B5=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../account/mypage/AccountMypageContainer.js | 14 ++++---- .../account/login/actions/authAction.ts | 2 +- .../account/login/reducers/authReducer.ts | 9 +++++- src/modules/account/login/sagas/authSaga.ts | 32 +++++++++++++++++-- 4 files changed, 46 insertions(+), 11 deletions(-) diff --git a/src/containers/account/mypage/AccountMypageContainer.js b/src/containers/account/mypage/AccountMypageContainer.js index ef42862f..98e94b15 100644 --- a/src/containers/account/mypage/AccountMypageContainer.js +++ b/src/containers/account/mypage/AccountMypageContainer.js @@ -321,13 +321,13 @@ const AccountMypageContainer = () => { const waitwait = () => { dispatch(userDeleteAction.request(user.cstmrSno)); // alert('아직 탈퇴 못해용~'); - setModal({ - isOpen: true, - title: '탈퇴 확인', - desc: '탈퇴가 완료되었습니다.', - color: 'primary' - }); - return; + // setModal({ + // isOpen: true, + // title: '탈퇴 확인', + // desc: '탈퇴가 완료되었습니다.', + // color: 'primary' + // }); + // return; }; return ( diff --git a/src/modules/account/login/actions/authAction.ts b/src/modules/account/login/actions/authAction.ts index 7e3ae40d..1d926c46 100644 --- a/src/modules/account/login/actions/authAction.ts +++ b/src/modules/account/login/actions/authAction.ts @@ -72,7 +72,7 @@ export const userDeleteAction = createAsyncAction( USERS_DELETE_REQUEST, USERS_DELETE_SUCCESS, USERS_DELETE_FAILURE -)(); +)(); export const pwUpdateAction = createAsyncAction( USERS_PWUPDATE_REQUEST, diff --git a/src/modules/account/login/reducers/authReducer.ts b/src/modules/account/login/reducers/authReducer.ts index 11400c41..2b8b7da0 100644 --- a/src/modules/account/login/reducers/authReducer.ts +++ b/src/modules/account/login/reducers/authReducer.ts @@ -12,6 +12,7 @@ import { logout, refresh, pwUpdateAction, + userDeleteAction } from '../actions/authAction'; import { UserPageState, UserPageData, initResponseUserPageData,UserPwState,UserData,UserPw,initResponseUserPwPageData,} from '../models/authModel'; @@ -23,6 +24,7 @@ export interface AuthState { message: string; user?: UserData; UserPw?: UserPw; + } // reducers @@ -78,8 +80,13 @@ export const authReducer = createReducer(initialState) draft.isLogin = false; draft.user = undefined; }) + ) + .handleAction(userDeleteAction.success, state => + produce(state, draft => { + draft.isLogin = false; + draft.user = undefined; + }) ); - export const mypageReducer = createReducer(initResponseUserPageData).handleAction(userPageAction.success, (state, action) => produce(state, draft => { const data: UserPageData = action.payload; diff --git a/src/modules/account/login/sagas/authSaga.ts b/src/modules/account/login/sagas/authSaga.ts index 88dd1b0a..057379e3 100644 --- a/src/modules/account/login/sagas/authSaga.ts +++ b/src/modules/account/login/sagas/authSaga.ts @@ -158,10 +158,38 @@ function* userDeletePageSaga( const { data } = yield call(authAPI.deletedata, controlId); // console.log('userPageData : ', data) + console.log("sdsdsd",data) + if (data.errorCode === '-1') { + yield put( + MessageActions.IS_ERROR({ + errorCode: ERROR_MESSAGE.code, + errorMessage: ERROR_MESSAGE.message, + isHistoryBack: false, + isRefresh: false + }) + ); yield put(Actions.userDeleteAction.success(data)); - } catch (error) { - yield put(Actions.userDeleteAction.failure(error)); + } else { + yield put( + MessageActions.IS_MESSAGE({ + messageCode: SAVE_MESSAGE.code, + message: SAVE_MESSAGE.message, + isHistoryBack: false, + isRefresh: true + }) + ); + } +} catch (error) { + yield put( + MessageActions.IS_ERROR({ + errorCode: ERROR_MESSAGE.code, + errorMessage: '처리 중 에러입니다.', + isHistoryBack: false, + isRefresh: false + }) + ); +} } function* userUpdateSaga( action: ActionType