Skip to content

Instantly share code, notes, and snippets.

@jbaxleyiii
Created January 4, 2018 11:51
Show Gist options
  • Select an option

  • Save jbaxleyiii/743067471f6fc4b1a8df747ddda6bcc3 to your computer and use it in GitHub Desktop.

Select an option

Save jbaxleyiii/743067471f6fc4b1a8df747ddda6bcc3 to your computer and use it in GitHub Desktop.
Mutation: {
upvotePost: (_, { postId }) => {
const post = find(posts, { id: postId });
if (!post) {
throw new Error(`Couldn't find post with id ${postId}`);
}
post.votes += 1;
return post;
},
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment