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


const setErrorInfo = (state,errorInfo)=>{
    let newState = JSON.parse(JSON.stringify(state));
    return Object.assign({},newState,{errorInfo});
};
const emptyErrorInfo = (state)=>{
    return Object.assign({},state,{errorInfo:{}})
}

export default function(state={}, action) {
    switch (action.type) {
        case actionTypes.SETREPLENISHERRORINFO:
            return setErrorInfo(state,action.errorInfo);
        case actionTypes.EMPTYREPLENISHERRORINFO :
            return emptyErrorInfo(state);
        default:
            return state;
    }
}