import { combineReducers } from 'redux' const liveInitialState = { loading: false, error: null, opt: {}, checkpoints: [], datasets: [], } const liveReducer = (state = liveInitialState, action) => { let results; switch(action.type) { case 'LOAD_PARAMS': if (! action.opt || ! Object.keys(action.opt).length) { return state } return { ...state, loading: false, error: null, opt: action.opt, } case 'SET_PARAM': return { ...state, opt: { ...state.opt, [action.key]: action.value, } } case 'LIST_CHECKPOINTS': return { ...state, checkpoints: action.checkpoints, } case 'LIST_DATASETS': return { ...state, datasets: action.datasets, } default: return state } } export default liveReducer