I want to edit some data in the cache manually.
How can I readQuery()
and writeQuery()
in vue-apollo directly from a method of a Vue component? Im looking for something like this.$apollo.readQuery(...)
, which does not work. Where do I get the store
instance from?
I mean the store instance from update()
method in e.g. this.$apollo.mutate
.
Inside a component you can grab the methods from this.$apollo.provider.defaultClient
methods: {
async doQuery (my_data) {
const apolloClient = this.$apollo.provider.defaultClient
apolloClient.writeQuery({
query: QUERY,
data: {
data: my_data,
},
})
},