import { LOGIN_SUCCESS, LOGIN_FAILURE } from '../actions/login'; const defaultState = { isLoggedIn: false, username: null, } export default function loginReducer(state = defaultState, action) { switch (action.type) { case LOGIN_SUCCESS: return { ...state, isLoggedIn: true, username: action.data.Username }; case LOGIN_FAILURE: return { ...state, isLoggedIn: false, username: null }; } return state; }