// ... imports | |
export default { | |
// ... queries | |
mutations: { | |
async createPoll(parent, args) { | |
const poll = await pollService.create(args.poll).catch(); | |
pubsub.publish(POLL_CREATED, { | |
[POLL_CREATED]: poll | |
}) | |
return poll | |
}, | |
// ... voteOnPoll | |
}, | |
subscriptions: { | |
[POLL_CREATED]: { | |
subscribe: () => pubsub.asyncIterator(POLL_CREATED), | |
}, | |
}, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment