From 3577ca1a2ffd33351de983a07c367cf94c0c0969 Mon Sep 17 00:00:00 2001 From: Ramon Wenger Date: Tue, 14 Jun 2022 22:10:13 +0200 Subject: [PATCH] Add first part of delete mutation call --- .../components/modules/SnapshotListItem.vue | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/client/src/components/modules/SnapshotListItem.vue b/client/src/components/modules/SnapshotListItem.vue index 25830075..62781f87 100644 --- a/client/src/components/modules/SnapshotListItem.vue +++ b/client/src/components/modules/SnapshotListItem.vue @@ -112,6 +112,34 @@ }) .catch(); }, + deleteSnapshot() { + this.$modal.open('confirm') + .then(() => { + this.$apollo.mutate({ + mutation: DELETE_SNAPSHOT_MUTATION, + variables: { + input: { + id: this.snapshot.id, + }, + }, + update: (store, {data: {deleteSnapshot: {result}}}) => { + if (result.__typename === 'Success') { + const slug = this.$route.params.slug; + const query = SNAPSHOTS_QUERY; + const variables = { + slug + }; + const module = store.readQuery({ + query, + variables + }); + + } + }, + }); + }) + .catch(); + }, share() { this.$apollo.mutate({ mutation: SHARE_SNAPSHOT_MUTATION,