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.
16 lines
420 B
16 lines
420 B
7 years ago
|
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;
|
||
|
}
|
||
|
};
|