fix: initial State user reducer

This commit is contained in:
Francesco Esposito 2019-07-31 20:26:20 +02:00
parent 95f98ba1c7
commit 6b92560620
1 changed files with 6 additions and 2 deletions

View File

@ -2,8 +2,12 @@ import { userConstants } from '../_constants/user.constants';
let userLocalStorage = JSON.parse(localStorage.getItem('user'));
const initialState = userLocalStorage ? {loggedIn: true} : {loggedIn: false};
console.log(initialState);
export function user(state = initialState, action) {
switch (action.type) {
case userConstants.LOGIN_REQUEST:
@ -34,7 +38,7 @@ export function user(state = initialState, action) {
};
default:
return {};
return state;
}
}