|
|
|
@ -25,7 +25,7 @@ import { Console } from 'console';
|
|
|
|
|
function* userLoginSaga(action: ActionType<typeof Actions.login.request>) { |
|
|
|
|
const param = action.payload; |
|
|
|
|
try { |
|
|
|
|
// console.log('=-===================');
|
|
|
|
|
// console.log('=-===================');
|
|
|
|
|
|
|
|
|
|
const { data, errorCode } = yield call(authAPI.usersLogin, param); |
|
|
|
|
//console.log('>>>>>11>>>>>>>', data);
|
|
|
|
@ -119,20 +119,19 @@ function* userLogoutSaga() {
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
if (accessToken) { |
|
|
|
|
// console.log('dddddddddddddddddddddddddddddddddddd');
|
|
|
|
|
// console.log('dddddddddddddddddddddddddddddddddddd');
|
|
|
|
|
const decodedToken = decode<LoginData>(accessToken); |
|
|
|
|
const res = yield call(authAPI.usersLogout, decodedToken.cstmrSno); |
|
|
|
|
console.log("res>>>>>>>>",res); |
|
|
|
|
if(res.data=="SUCCESS"){ |
|
|
|
|
location.reload(); |
|
|
|
|
} |
|
|
|
|
console.log('res>>>>>>>>', res); |
|
|
|
|
// if(res.data=="SUCCESS"){
|
|
|
|
|
// location.reload();
|
|
|
|
|
// }
|
|
|
|
|
} |
|
|
|
|
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)); |
|
|
|
|
} |
|
|
|
@ -141,11 +140,11 @@ function* userLogoutSaga() {
|
|
|
|
|
function* userPageSaga( |
|
|
|
|
action: ActionType<typeof Actions.userPageAction.request> |
|
|
|
|
) { |
|
|
|
|
try{ |
|
|
|
|
try { |
|
|
|
|
const controlId = action.payload; |
|
|
|
|
|
|
|
|
|
const { data } = yield call(authAPI.getUserPage, controlId); |
|
|
|
|
// console.log('userPageData : ', data)
|
|
|
|
|
// console.log('userPageData : ', data)
|
|
|
|
|
yield put(Actions.userPageAction.success(data)); |
|
|
|
|
} catch (error) { |
|
|
|
|
yield put(Actions.userPageAction.failure(error)); |
|
|
|
@ -153,80 +152,80 @@ function* userPageSaga(
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function* userUpdateSaga( |
|
|
|
|
action: ActionType<typeof Actions.userupdateAction.request>) { |
|
|
|
|
action: ActionType<typeof Actions.userupdateAction.request> |
|
|
|
|
) { |
|
|
|
|
const param = action.payload; |
|
|
|
|
try{ |
|
|
|
|
const { data,errorCode } = yield call(authAPI.updateUser, param); |
|
|
|
|
try { |
|
|
|
|
const { data, errorCode } = yield call(authAPI.updateUser, param); |
|
|
|
|
yield put(Actions.pwUpdateAction.success(data)); |
|
|
|
|
if (data.errorCode==='-1') { |
|
|
|
|
if (data.errorCode === '-1') { |
|
|
|
|
yield put( |
|
|
|
|
MessageActions.IS_ERROR({ |
|
|
|
|
errorCode: ERROR_MESSAGE.code, |
|
|
|
|
errorMessage: ERROR_MESSAGE.message, |
|
|
|
|
isHistoryBack: false, |
|
|
|
|
isRefresh: false |
|
|
|
|
MessageActions.IS_ERROR({ |
|
|
|
|
errorCode: ERROR_MESSAGE.code, |
|
|
|
|
errorMessage: ERROR_MESSAGE.message, |
|
|
|
|
isHistoryBack: false, |
|
|
|
|
isRefresh: false |
|
|
|
|
}) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
|
} else { |
|
|
|
|
yield put( |
|
|
|
|
MessageActions.IS_MESSAGE({ |
|
|
|
|
messageCode: SAVE_MESSAGE.code, |
|
|
|
|
message: SAVE_MESSAGE.message, |
|
|
|
|
isHistoryBack: false, |
|
|
|
|
isRefresh: true |
|
|
|
|
MessageActions.IS_MESSAGE({ |
|
|
|
|
messageCode: SAVE_MESSAGE.code, |
|
|
|
|
message: SAVE_MESSAGE.message, |
|
|
|
|
isHistoryBack: false, |
|
|
|
|
isRefresh: true |
|
|
|
|
}) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} catch (error) {
|
|
|
|
|
} |
|
|
|
|
} catch (error) { |
|
|
|
|
yield put( |
|
|
|
|
MessageActions.IS_ERROR({ |
|
|
|
|
MessageActions.IS_ERROR({ |
|
|
|
|
errorCode: ERROR_MESSAGE.code, |
|
|
|
|
errorMessage: '처리 중 에러입니다.', |
|
|
|
|
isHistoryBack: false, |
|
|
|
|
isRefresh: false |
|
|
|
|
}) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
function* userPwSaga( |
|
|
|
|
action: ActionType<typeof Actions.pwUpdateAction.request>) { |
|
|
|
|
action: ActionType<typeof Actions.pwUpdateAction.request> |
|
|
|
|
) { |
|
|
|
|
const param = action.payload; |
|
|
|
|
try{ |
|
|
|
|
const { data,errorCode } = yield call(authAPI.pwupdate, param); |
|
|
|
|
try { |
|
|
|
|
const { data, errorCode } = yield call(authAPI.pwupdate, param); |
|
|
|
|
//yield put(Actions.pwUpdateAction.success(data));
|
|
|
|
|
// console.log("saaa",data);
|
|
|
|
|
if (data.errorCode==='-1') { |
|
|
|
|
// console.log("saaa",data);
|
|
|
|
|
if (data.errorCode === '-1') { |
|
|
|
|
yield put( |
|
|
|
|
MessageActions.IS_ERROR({ |
|
|
|
|
errorCode: ERROR_MESSAGE.code, |
|
|
|
|
errorMessage: ERROR_MESSAGE.message, |
|
|
|
|
isHistoryBack: false, |
|
|
|
|
isRefresh: false |
|
|
|
|
MessageActions.IS_ERROR({ |
|
|
|
|
errorCode: ERROR_MESSAGE.code, |
|
|
|
|
errorMessage: ERROR_MESSAGE.message, |
|
|
|
|
isHistoryBack: false, |
|
|
|
|
isRefresh: false |
|
|
|
|
}) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
|
} else { |
|
|
|
|
yield put( |
|
|
|
|
MessageActions.IS_MESSAGE({ |
|
|
|
|
messageCode: SAVE_MESSAGE.code, |
|
|
|
|
message: SAVE_MESSAGE.message, |
|
|
|
|
isHistoryBack: true, |
|
|
|
|
isRefresh: true |
|
|
|
|
MessageActions.IS_MESSAGE({ |
|
|
|
|
messageCode: SAVE_MESSAGE.code, |
|
|
|
|
message: SAVE_MESSAGE.message, |
|
|
|
|
isHistoryBack: true, |
|
|
|
|
isRefresh: true |
|
|
|
|
}) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} catch (error) {
|
|
|
|
|
} |
|
|
|
|
} catch (error) { |
|
|
|
|
yield put( |
|
|
|
|
MessageActions.IS_ERROR({ |
|
|
|
|
MessageActions.IS_ERROR({ |
|
|
|
|
errorCode: ERROR_MESSAGE.code, |
|
|
|
|
errorMessage: '비밀번호를 확인해주세요', |
|
|
|
|
isHistoryBack: false, |
|
|
|
|
isRefresh: false |
|
|
|
|
}) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// function* updateSaga(action: ActionType<typeof Actions.userupdateAction.request>) {
|
|
|
|
|
// try {
|
|
|
|
|
// const detail = action.payload;
|
|
|
|
|