remove automatic logout after 15min
This commit is contained in:
parent
c74f427fd5
commit
02f0e1cf3c
@ -63,9 +63,6 @@ export const loadUser = () => (dispatch) => {
|
||||
});
|
||||
};
|
||||
|
||||
var logoutTimerId;
|
||||
const timeToLogout = 14.9 * 60 * 1000; // nearly 15 minutes corresponding to the API
|
||||
|
||||
// Login user
|
||||
export const login =
|
||||
({ email, password }) =>
|
||||
@ -84,10 +81,6 @@ export const login =
|
||||
axios
|
||||
.post(`${process.env.REACT_APP_BLOCKLY_API}/user`, body, config)
|
||||
.then((res) => {
|
||||
// Logout automatically if refreshToken "expired"
|
||||
const logoutTimer = () =>
|
||||
setTimeout(() => dispatch(logout()), timeToLogout);
|
||||
logoutTimerId = logoutTimer();
|
||||
dispatch(setLanguage(res.data.user.language));
|
||||
dispatch({
|
||||
type: LOGIN_SUCCESS,
|
||||
@ -144,7 +137,6 @@ export const logout = () => (dispatch) => {
|
||||
}
|
||||
dispatch(setLanguage(locale));
|
||||
dispatch(returnSuccess(res.data.message, res.status, "LOGOUT_SUCCESS"));
|
||||
clearTimeout(logoutTimerId);
|
||||
},
|
||||
error: (err) => {
|
||||
dispatch(
|
||||
@ -165,7 +157,6 @@ export const logout = () => (dispatch) => {
|
||||
type: GET_STATUS,
|
||||
payload: status,
|
||||
});
|
||||
clearTimeout(logoutTimerId);
|
||||
},
|
||||
};
|
||||
axios
|
||||
@ -222,10 +213,6 @@ export const authInterceptor = () => (dispatch, getState) => {
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.status === 200) {
|
||||
clearTimeout(logoutTimerId);
|
||||
const logoutTimer = () =>
|
||||
setTimeout(() => dispatch(logout()), timeToLogout);
|
||||
logoutTimerId = logoutTimer();
|
||||
dispatch({
|
||||
type: REFRESH_TOKEN_SUCCESS,
|
||||
payload: res.data,
|
||||
|
Loading…
x
Reference in New Issue
Block a user