Last active
September 5, 2017 14:47
-
-
Save matthieu-D/20865a2c82e74b17dd11d39ec4fb56ca 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
updateUser(user) { | |
this.apollo.mutate<Response>({ | |
mutation: updateUser, | |
variables: { | |
id: user.id, | |
newName: user.name | |
}, | |
update: (store, { data: { update }}) => { | |
let data = store.readQuery({ query: Users }); | |
(<any> data).users = update; | |
store.writeQuery({ query: Users, data }); | |
} | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment