Skip to content

Instantly share code, notes, and snippets.

@matthieu-D
Last active September 5, 2017 14:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthieu-D/20865a2c82e74b17dd11d39ec4fb56ca to your computer and use it in GitHub Desktop.
Save matthieu-D/20865a2c82e74b17dd11d39ec4fb56ca to your computer and use it in GitHub Desktop.
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