Files: 153b2ae34195193ff8c51e32d55de4ba79ea73b5 / poll / async / publishChooseOne.js
332 bytesRaw
1 | const ChooseOne = require('../sync/buildChooseOne') |
2 | const { isPoll, getPollErrors } = require('ssb-poll-schema') |
3 | |
4 | module.exports = function (server) { |
5 | return function publishChooseOne (opts, cb) { |
6 | const poll = ChooseOne(opts) |
7 | if (!isPoll.chooseOne(poll)) return cb(getPollErrors(poll)) |
8 | |
9 | server.publish(poll, cb) |
10 | } |
11 | } |
12 |
Built with git-ssb-web