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