diff options
author | ThibG <thib@sitedethib.com> | 2020-04-17 22:36:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-17 22:36:48 +0200 |
commit | 62e65dca11e1c39630db2958c514c45407dcdfa7 (patch) | |
tree | 92b5f9a2f93a2355dd94bac7e63e8fd9c552dafb /app/javascript/flavours/glitch/containers | |
parent | 5fdd5eef5a6b05b072a57e065954fdcb0b4a8898 (diff) | |
parent | 81ef26b67d01aaa693edbdcf7a8f2a6cdfd56920 (diff) |
Merge pull request #1318 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/javascript/flavours/glitch/containers')
-rw-r--r-- | app/javascript/flavours/glitch/containers/poll_container.js | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/containers/poll_container.js b/app/javascript/flavours/glitch/containers/poll_container.js index da93cc905..345351cc6 100644 --- a/app/javascript/flavours/glitch/containers/poll_container.js +++ b/app/javascript/flavours/glitch/containers/poll_container.js @@ -1,8 +1,25 @@ import { connect } from 'react-redux'; +import { debounce } from 'lodash'; + import Poll from 'flavours/glitch/components/poll'; +import { fetchPoll, vote } from 'flavours/glitch/actions/polls'; + +const mapDispatchToProps = (dispatch, { pollId }) => ({ + refresh: debounce( + () => { + dispatch(fetchPoll(pollId)); + }, + 1000, + { leading: true }, + ), + + onVote (choices) { + dispatch(vote(pollId, choices)); + }, +}); const mapStateToProps = (state, { pollId }) => ({ poll: state.getIn(['polls', pollId]), }); -export default connect(mapStateToProps)(Poll); +export default connect(mapStateToProps, mapDispatchToProps)(Poll); |