bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/polling/service.js
Oleksandr Zhurbenko 251bd22738 PR review fixes
2017-09-06 12:36:52 -07:00

26 lines
524 B
JavaScript

import { makeCall } from '/imports/ui/services/api';
import Polls from '/imports/api/2.0/polls';
const mapPolls = function () {
const poll = Polls.findOne({});
if (!poll) {
return { pollExists: false };
}
const amIRequester = poll.requester !== 'userId';
return {
poll: {
answers: poll.answers,
pollId: poll.id,
},
pollExists: true,
amIRequester,
handleVote(pollId, answerId) {
makeCall('publishVote', pollId, answerId.id);
},
};
};
export default { mapPolls };