1
0
mirror of https://github.com/whippyshou/mastodon synced 2024-11-29 15:28:27 +09:00
whippy-edition/app/javascript/mastodon/reducers/lists.js

16 lines
420 B
JavaScript
Raw Normal View History

2017-11-25 08:35:37 +09:00
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;
}
};