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) {
|
mutation updatePost($id: ID!, $votes: Int) {
|
||||||
updatePost(id: $id, votes: $votes) {
|
updatePost(id: $id, votes: $votes) {
|
||||||
id
|
id
|
||||||
|
__typename
|
||||||
votes
|
votes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,7 +44,9 @@ export default graphql(upvotePost, {
|
||||||
upvote: (id, votes) => mutate({
|
upvote: (id, votes) => mutate({
|
||||||
variables: { id, votes },
|
variables: { id, votes },
|
||||||
optimisticResponse: {
|
optimisticResponse: {
|
||||||
|
__typename: 'Mutation',
|
||||||
updatePost: {
|
updatePost: {
|
||||||
|
__typename: 'Post',
|
||||||
id: ownProps.id,
|
id: ownProps.id,
|
||||||
votes: ownProps.votes + 1
|
votes: ownProps.votes + 1
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ const upvotePost = gql`
|
||||||
mutation updatePost($id: ID!, $votes: Int) {
|
mutation updatePost($id: ID!, $votes: Int) {
|
||||||
updatePost(id: $id, votes: $votes) {
|
updatePost(id: $id, votes: $votes) {
|
||||||
id
|
id
|
||||||
|
__typename
|
||||||
votes
|
votes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,7 +44,9 @@ export default graphql(upvotePost, {
|
||||||
upvote: (id, votes) => mutate({
|
upvote: (id, votes) => mutate({
|
||||||
variables: { id, votes },
|
variables: { id, votes },
|
||||||
optimisticResponse: {
|
optimisticResponse: {
|
||||||
|
__typename: 'Mutation',
|
||||||
updatePost: {
|
updatePost: {
|
||||||
|
__typename: 'Post',
|
||||||
id: ownProps.id,
|
id: ownProps.id,
|
||||||
votes: ownProps.votes + 1
|
votes: ownProps.votes + 1
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue