This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
2019-08-31 03:53:10 -07:00
|
|
|
import { POLLS_IMPORT } from 'flavours/glitch/actions/importer';
|
2019-03-03 13:18:23 -08:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|