Last active
May 18, 2019 17:26
-
-
Save LazyFatArrow/6ca49464866009ba8fe2af7e4885d189 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... 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