import { Util } from '../util/util';
export default function baseReducer(state, action) {
    switch (action.type) {
        case 'CONFIG_LOADING':
            return Object.assign({}, state, { isLoading: true, timestamp: Util.getTimeStamp() });
        case 'CONFIG_LOADED':
            let newState = Object.assign({}, state, { isLoading: false });
            Object.keys(action.payload).forEach((k) => {
                newState[k] = action.payload[k];
            });
            newState.timestamp = Util.getTimeStamp();
            return newState;
        case 'SET_CONFIG':
            let newConfig = Object.assign({}, state);
            Object.keys(action.payload).forEach((k) => {
                newConfig[k] = action.payload[k];
            });
            newConfig.timestamp = Util.getTimeStamp();
            return newConfig;
        default:
            return state;
    }
}
//# sourceMappingURL=base-reducer.js.map