Skip to content

Instantly share code, notes, and snippets.

@LazyFatArrow
Last active May 18, 2019 17:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LazyFatArrow/6ca49464866009ba8fe2af7e4885d189 to your computer and use it in GitHub Desktop.
Save LazyFatArrow/6ca49464866009ba8fe2af7e4885d189 to your computer and use it in GitHub Desktop.
// ... 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