Browse Source

회원탈퇴 페이징 이동

pull/2/head
sanguu 2 years ago
parent
commit
6c8ed958f4
  1. 86
      src/modules/account/login/sagas/authSaga.ts

86
src/modules/account/login/sagas/authSaga.ts

@ -153,43 +153,75 @@ function* userPageSaga(
function* userDeletePageSaga( function* userDeletePageSaga(
action: ActionType<typeof Actions.userDeleteAction.request> action: ActionType<typeof Actions.userDeleteAction.request>
) { ) {
// try {
// const controlId = action.payload;
// const { data } = yield call(authAPI.deletedata, controlId);
// // console.log('userPageData : ', 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));
// } else {
// yield put(
// MessageActions.IS_MESSAGE({
// messageCode: SAVE_MESSAGE.code,
// message: SAVE_MESSAGE.message,
// isHistoryBack: false,
// isRefresh: false
// })
// );
// cookieStorage.removeCookie(COOKIE_ACCESS_TOKEN);
// cookieStorage.removeCookie(COOKIE_REFRESH_TOKEN);
// yield put(replace('/'));
// }
// } catch (error) {
// yield put(
// MessageActions.IS_ERROR({
// errorCode: ERROR_MESSAGE.code,
// errorMessage: '처리 중 에러입니다.',
// isHistoryBack: false,
// isRefresh: false
// })
// );
// }
// }
const accessToken = cookieStorage.getCookie(COOKIE_ACCESS_TOKEN);
//console.log('accessToken', accessToken);
try { try {
const controlId = action.payload; const controlId = action.payload;
// console.log('dddddddddddddddddddddddddddddddddddd');
const { data } = yield call(authAPI.deletedata, controlId); const { data } = yield call(authAPI.deletedata, controlId);
// console.log('userPageData : ', data)
console.log("sdsdsd",data) if (data.result === true) {
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));
} else {
yield put( yield put(
MessageActions.IS_MESSAGE({ MessageActions.IS_MESSAGE({
messageCode: SAVE_MESSAGE.code, messageCode: SAVE_MESSAGE.code,
message: SAVE_MESSAGE.message, message: SAVE_MESSAGE.message,
isHistoryBack: false, isHistoryBack: false,
isRefresh: true isRefresh: false
}) })
); );
location.href = '/account/login';
// yield put(Actions.userDeleteAction.success(data));;
}
// yield put(Actions.logout.success());
cookieStorage.removeCookie(COOKIE_ACCESS_TOKEN);
cookieStorage.removeCookie(COOKIE_REFRESH_TOKEN);
yield put(replace('/'));
} catch (error) {
yield put(Actions.logout.failure(error));
} }
} catch (error) {
yield put(
MessageActions.IS_ERROR({
errorCode: ERROR_MESSAGE.code,
errorMessage: '처리 중 에러입니다.',
isHistoryBack: false,
isRefresh: false
})
);
}
} }
function* userUpdateSaga( function* userUpdateSaga(
action: ActionType<typeof Actions.userupdateAction.request> action: ActionType<typeof Actions.userupdateAction.request>
@ -216,6 +248,10 @@ function* userUpdateSaga(
isRefresh: true isRefresh: true
}) })
); );
cookieStorage.removeCookie(COOKIE_ACCESS_TOKEN);
cookieStorage.removeCookie(COOKIE_REFRESH_TOKEN);
yield put(replace('/'));
} }
} catch (error) { } catch (error) {
yield put( yield put(

Loading…
Cancel
Save