27 lines
497 B
JavaScript
Raw Normal View History

2017-03-18 17:34:00 +01:00
/*
*
* List reducer
*
*/
import { fromJS } from 'immutable';
2017-05-11 10:54:44 +02:00
import { LOAD_MODELS, LOADED_MODELS } from './constants';
2017-03-18 17:34:00 +01:00
const initialState = fromJS({
loading: false,
models: false,
2017-03-18 17:34:00 +01:00
});
function appReducer(state = initialState, action) {
switch (action.type) {
case LOAD_MODELS:
2017-05-11 10:54:44 +02:00
return state.set('loading', true);
2017-03-18 17:34:00 +01:00
case LOADED_MODELS:
2017-05-11 10:54:44 +02:00
return state.set('loading', false).set('models', action.models);
2017-03-18 17:34:00 +01:00
default:
return state;
}
}
export default appReducer;