From 18ffb249410b9ab4748fd3af9ddce6968cb3eb93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=8Carodej?= Date: Thu, 7 Apr 2022 12:17:49 +0200 Subject: [PATCH] after cancelled shared link in SharedLinks, remove items from view --- resources/js/store/modules/sharing.js | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/resources/js/store/modules/sharing.js b/resources/js/store/modules/sharing.js index 81b3ead6..45067ed4 100644 --- a/resources/js/store/modules/sharing.js +++ b/resources/js/store/modules/sharing.js @@ -69,16 +69,8 @@ const actions = { }, shareCancel: ({ commit, getters }, singleItem) => { return new Promise((resolve, reject) => { - let tokens = [] - let items = [singleItem] - - if (!singleItem) { - items = getters.clipboard - } - - items.forEach((item) => { - tokens.push(item.data.relationships.shared.data.attributes.token) - }) + let items = singleItem ? [singleItem] : getters.clipboard + let tokens = items.map((item) => item.data.relationships.shared.data.attributes.token) axios .post('/api/share/revoke', { @@ -88,16 +80,13 @@ const actions = { .then(() => { items.forEach((item) => { // Remove item from file browser - if ( - getters.currentFolder && - Vue.prototype.$isThisRoute(router.currentRoute, ['MySharedItems']) - ) { + if (Vue.prototype.$isThisRoute(router.currentRoute, ['MySharedItems'])) { commit('REMOVE_ITEM', item.data.id) + commit('CLIPBOARD_CLEAR') } // Flush shared data commit('FLUSH_SHARED', item.data.id) - commit('CLIPBOARD_CLEAR') }) resolve(true) })