store locale in localStorage only if user is not logged in
This commit is contained in:
parent
49730f51ac
commit
b04a5bc591
@ -54,6 +54,9 @@ const timeToLogout = 14.9*60*1000; // nearly 15 minutes corresponding to the API
|
|||||||
|
|
||||||
// Login user
|
// Login user
|
||||||
export const login = ({ email, password }) => (dispatch) => {
|
export const login = ({ email, password }) => (dispatch) => {
|
||||||
|
dispatch({
|
||||||
|
type: USER_LOADING
|
||||||
|
});
|
||||||
// Headers
|
// Headers
|
||||||
const config = {
|
const config = {
|
||||||
headers: {
|
headers: {
|
||||||
@ -70,11 +73,11 @@ export const login = ({ email, password }) => (dispatch) => {
|
|||||||
timeToLogout
|
timeToLogout
|
||||||
);
|
);
|
||||||
logoutTimerId = logoutTimer();
|
logoutTimerId = logoutTimer();
|
||||||
|
dispatch(setLanguage(res.data.user.language));
|
||||||
dispatch({
|
dispatch({
|
||||||
type: LOGIN_SUCCESS,
|
type: LOGIN_SUCCESS,
|
||||||
payload: res.data
|
payload: res.data
|
||||||
});
|
});
|
||||||
dispatch(setLanguage(res.data.user.language));
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: GET_STATUS,
|
type: GET_STATUS,
|
||||||
payload: res.data.user.status
|
payload: res.data.user.status
|
||||||
|
@ -8,7 +8,7 @@ export const visitPage = () => (dispatch) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const setLanguage = (language) => (dispatch, getState) => {
|
export const setLanguage = (language) => (dispatch, getState) => {
|
||||||
if(!getState().auth.isAuthenticated){
|
if(!getState().auth.progress && !getState().auth.isAuthenticated){
|
||||||
window.localStorage.setItem('locale', language);
|
window.localStorage.setItem('locale', language);
|
||||||
}
|
}
|
||||||
dispatch({
|
dispatch({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user