after cancelled shared link in SharedLinks, remove items from view

This commit is contained in:
Čarodej
2022-04-07 12:17:49 +02:00
parent f5879c0670
commit 18ffb24941

View File

@@ -69,16 +69,8 @@ const actions = {
}, },
shareCancel: ({ commit, getters }, singleItem) => { shareCancel: ({ commit, getters }, singleItem) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let tokens = [] let items = singleItem ? [singleItem] : getters.clipboard
let items = [singleItem] let tokens = items.map((item) => item.data.relationships.shared.data.attributes.token)
if (!singleItem) {
items = getters.clipboard
}
items.forEach((item) => {
tokens.push(item.data.relationships.shared.data.attributes.token)
})
axios axios
.post('/api/share/revoke', { .post('/api/share/revoke', {
@@ -88,16 +80,13 @@ const actions = {
.then(() => { .then(() => {
items.forEach((item) => { items.forEach((item) => {
// Remove item from file browser // Remove item from file browser
if ( if (Vue.prototype.$isThisRoute(router.currentRoute, ['MySharedItems'])) {
getters.currentFolder &&
Vue.prototype.$isThisRoute(router.currentRoute, ['MySharedItems'])
) {
commit('REMOVE_ITEM', item.data.id) commit('REMOVE_ITEM', item.data.id)
commit('CLIPBOARD_CLEAR')
} }
// Flush shared data // Flush shared data
commit('FLUSH_SHARED', item.data.id) commit('FLUSH_SHARED', item.data.id)
commit('CLIPBOARD_CLEAR')
}) })
resolve(true) resolve(true)
}) })