Files
static-cms/src/reducers/collections.js
2016-06-05 01:52:18 -07:00

17 lines
502 B
JavaScript

import { OrderedMap, fromJS } from 'immutable';
import { CONFIG_SUCCESS } from '../actions/config';
export function collections(state = null, action) {
switch (action.type) {
case CONFIG_SUCCESS:
const collections = action.payload && action.payload.collections;
return OrderedMap().withMutations((map) => {
(collections || []).forEach(function(collection) {
map.set(collection.name, fromJS(collection));
});
});
default:
return state;
}
}