mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-12-05 00:59:04 +01:00
15 lines
470 B
JavaScript
15 lines
470 B
JavaScript
import { POLLS_IMPORT } from 'flavours/glitch/actions/importer';
|
|
import { Map as ImmutableMap, fromJS } from 'immutable';
|
|
|
|
const importPolls = (state, polls) => state.withMutations(map => polls.forEach(poll => map.set(poll.id, fromJS(poll))));
|
|
|
|
const initialState = ImmutableMap();
|
|
|
|
export default function polls(state = initialState, action) {
|
|
switch(action.type) {
|
|
case POLLS_IMPORT:
|
|
return importPolls(state, action.polls);
|
|
default:
|
|
return state;
|
|
}
|
|
}
|