You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
420 B

  1. import { LIST_FETCH_SUCCESS } from '../actions/lists';
  2. import { Map as ImmutableMap, fromJS } from 'immutable';
  3. const initialState = ImmutableMap();
  4. const normalizeList = (state, list) => state.set(list.id, fromJS(list));
  5. export default function lists(state = initialState, action) {
  6. switch(action.type) {
  7. case LIST_FETCH_SUCCESS:
  8. return normalizeList(state, action.list);
  9. default:
  10. return state;
  11. }
  12. };