static-cms/src/reducers/config.js

16 lines
465 B
JavaScript
Raw Normal View History

2016-02-25 00:45:56 -08:00
import Immutable from 'immutable';
import { CONFIG_REQUEST, CONFIG_SUCCESS, CONFIG_FAILURE } from '../actions/config';
2016-02-25 00:45:56 -08:00
export function config(state = null, action) {
switch (action.type) {
case CONFIG_REQUEST:
2016-02-25 00:45:56 -08:00
return Immutable.Map({isFetching: true});
case CONFIG_SUCCESS:
2016-02-25 00:45:56 -08:00
return Immutable.fromJS(action.payload);
case CONFIG_FAILURE:
2016-02-25 00:45:56 -08:00
return Immutable.Map({error: action.payload.toString()});
default:
return state;
}
}