I am integrating apollo into my vue.js application and encountering an issue while attempting to delete an object using a mutation. Below is the code snippet I am using:
this.$apollo.mutate({
mutation: require("../graphql/deleteTag.gql"),
variables: {
id: idToDelete,
},
update: (store, { data: { delete_tags } }) => {
if (delete_tags.affected_rows) {
const data = store.readQuery({
query: require("../graphql/fetchDevices.gql"),
});
data.device_id_to_tag_id = data.device_id_to_tag_id.filter((x) => {
return x.id != tag.device_id_to_tag_id.id;
});
store.writeQuery({
query: require("../graphql/fetchDevices.gql"),
data,
});
}
},
});
Here is the content of my deleteTag.gql file :
mutation delete_tags($id: Int!){
delete_extras_taggeditem(where: { id: { _eq: $id } }) {
affected_rows
}
}
However, when I execute the code, an error is being displayed as shown in this screenshot: https://i.sstatic.net/XGHL2.png
I am unsure of what is causing this issue as I have followed the guidelines provided in the Hasura vue.js documentation. Appreciate any assistance in resolving this problem. Thank you!