|
|
|
@@ -5,20 +5,20 @@ import { |
|
|
|
LOGOUT_USER, |
|
|
|
REFRESH_TOKEN, |
|
|
|
} from "../actions/login/loginActionConstants"; |
|
|
|
import { attemptLogin, logoutUserRequest } from "../../request/loginRequest"; |
|
|
|
import { attemptLogin, logoutUserRequest } from "@request/loginRequest"; |
|
|
|
import { |
|
|
|
fetchUserError, |
|
|
|
fetchUserSuccess, |
|
|
|
resetLoginState, |
|
|
|
} from "../actions/login/loginActions"; |
|
|
|
import { setUser } from "../actions/user/userActions"; |
|
|
|
import { resetUserState, setUser } from "../actions/user/userActions"; |
|
|
|
import { addHeaderToken, removeHeaderToken } from "../../request"; |
|
|
|
import { |
|
|
|
JWT_REFRESH_TOKEN, |
|
|
|
JWT_TOKEN, |
|
|
|
} from "../../constants/localStorage"; |
|
|
|
import { storeData, getData, clearAll } from "../../service/asyncStorage"; |
|
|
|
import { rejectErrorCodeHelper } from "../../utils/rejectErrorMessageHelper"; |
|
|
|
} from "@constants/localStorage"; |
|
|
|
import { storeData, getData, removeData } from "@service/asyncStorage"; |
|
|
|
import { rejectErrorCodeHelper } from "@utils/rejectErrorMessageHelper"; |
|
|
|
|
|
|
|
function* fetchUser({ payload }) { |
|
|
|
try { |
|
|
|
@@ -50,8 +50,10 @@ function* logoutUser() { |
|
|
|
console.log(error); // eslint-disable-line |
|
|
|
} finally { |
|
|
|
yield call(removeHeaderToken); |
|
|
|
yield call(clearAll); |
|
|
|
yield call(removeData, JWT_REFRESH_TOKEN) |
|
|
|
yield call(removeData, JWT_TOKEN); |
|
|
|
yield put(resetLoginState()); |
|
|
|
yield put(resetUserState()); |
|
|
|
} |
|
|
|
} |
|
|
|
|