import actionTypes from '../actiontype/user';

const saveUser = (content,data)=>{
    if(data.employee){
        data = Object.assign({},data,data.employee);
    }
    return Object.assign({},content,data);
};

const emptyUser = ()=>{
    return Object.assign({});
}

export default function(state={}, action) {
    switch (action.type) {
        case actionTypes.SAVEUSERINFO:
            return saveUser(state,action.data);
        case actionTypes.LOGOUTUSER:
            return emptyUser();
        default:
            return state;
    }
}