Gab Social. All are welcome.
This commit is contained in:
15
app/javascript/gabsocial/reducers/polls.js
Normal file
15
app/javascript/gabsocial/reducers/polls.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import { POLLS_IMPORT } from 'gabsocial/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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user