bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/polling/service.js
2017-06-19 08:57:32 -03:00

26 lines
533 B
JavaScript
Executable File

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