static-cms/src/reducers/config.js
Andrey Okonetchnikov 5b5f1edb22 Moved applyDefaults function and related code to actions (where it belong).
- Moved applyDefaults + related code
- Added tests for /actions/config.js
- Fixed some ESLint errors
2016-11-11 12:32:03 +01:00

18 lines
490 B
JavaScript

import Immutable from 'immutable';
import { CONFIG_REQUEST, CONFIG_SUCCESS, CONFIG_FAILURE } from '../actions/config';
const config = (state = null, action) => {
switch (action.type) {
case CONFIG_REQUEST:
return Immutable.Map({ isFetching: true });
case CONFIG_SUCCESS:
return Immutable.fromJS(action.payload);
case CONFIG_FAILURE:
return Immutable.Map({ error: action.payload.toString() });
default:
return state;
}
};
export default config;