mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-18 16:22:14 +00:00
after cancelled shared link in SharedLinks, remove items from view
This commit is contained in:
19
resources/js/store/modules/sharing.js
vendored
19
resources/js/store/modules/sharing.js
vendored
@@ -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)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user