2019-03-04 06:18:23 +09:00
|
|
|
import { connect } from 'react-redux';
|
2020-04-17 03:16:20 +09:00
|
|
|
import { debounce } from 'lodash';
|
|
|
|
|
2019-03-04 06:18:23 +09:00
|
|
|
import Poll from 'mastodon/components/poll';
|
2020-04-17 03:16:20 +09:00
|
|
|
import { fetchPoll } from 'mastodon/actions/polls';
|
|
|
|
|
|
|
|
const mapDispatchToProps = (dispatch, { pollId }) => ({
|
|
|
|
refresh: debounce(
|
|
|
|
() => {
|
|
|
|
dispatch(fetchPoll(pollId));
|
|
|
|
},
|
|
|
|
1000,
|
|
|
|
{ leading: true },
|
|
|
|
),
|
|
|
|
});
|
2019-03-04 06:18:23 +09:00
|
|
|
|
|
|
|
const mapStateToProps = (state, { pollId }) => ({
|
|
|
|
poll: state.getIn(['polls', pollId]),
|
|
|
|
});
|
|
|
|
|
2020-04-17 03:16:20 +09:00
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(Poll);
|