mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Remove warning when upvoting a post in apollo examples (#2190)
* Fix apollo warning and error when upvoting post * Fix apollo warning and error when upvoting post in apollo-redux example as well
This commit is contained in:
parent
b7de7a5733
commit
5d71434121
|
@ -33,6 +33,7 @@ const upvotePost = gql`
|
|||
mutation updatePost($id: ID!, $votes: Int) {
|
||||
updatePost(id: $id, votes: $votes) {
|
||||
id
|
||||
__typename
|
||||
votes
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +44,9 @@ export default graphql(upvotePost, {
|
|||
upvote: (id, votes) => mutate({
|
||||
variables: { id, votes },
|
||||
optimisticResponse: {
|
||||
__typename: 'Mutation',
|
||||
updatePost: {
|
||||
__typename: 'Post',
|
||||
id: ownProps.id,
|
||||
votes: ownProps.votes + 1
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ const upvotePost = gql`
|
|||
mutation updatePost($id: ID!, $votes: Int) {
|
||||
updatePost(id: $id, votes: $votes) {
|
||||
id
|
||||
__typename
|
||||
votes
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +44,9 @@ export default graphql(upvotePost, {
|
|||
upvote: (id, votes) => mutate({
|
||||
variables: { id, votes },
|
||||
optimisticResponse: {
|
||||
__typename: 'Mutation',
|
||||
updatePost: {
|
||||
__typename: 'Post',
|
||||
id: ownProps.id,
|
||||
votes: ownProps.votes + 1
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue