chore: remove prompts events
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
|
||||
<template #actions>
|
||||
<action :disabled="loading" icon="mode_edit" :label="$t('buttons.rename')" show="rename" />
|
||||
<action :disabled="loading" icon="delete" :label="$t('buttons.delete')" show="delete" />
|
||||
<action :disabled="loading" icon="delete" :label="$t('buttons.delete')" @action="deleteFile" id="delete-button" />
|
||||
<action :disabled="loading" icon="file_download" :label="$t('buttons.download')" @action="download" />
|
||||
<action :disabled="loading" icon="info" :label="$t('buttons.info')" show="info" />
|
||||
</template>
|
||||
@@ -126,24 +126,27 @@ export default {
|
||||
async mounted () {
|
||||
window.addEventListener('keydown', this.key)
|
||||
this.listing = this.oldReq.items
|
||||
this.$root.$on('preview-deleted', this.deleted)
|
||||
this.updatePreview()
|
||||
},
|
||||
beforeDestroy () {
|
||||
window.removeEventListener('keydown', this.key)
|
||||
this.$root.$off('preview-deleted', this.deleted)
|
||||
},
|
||||
methods: {
|
||||
deleted () {
|
||||
this.listing = this.listing.filter(item => item.name !== this.name)
|
||||
deleteFile () {
|
||||
this.$store.commit('showHover', {
|
||||
prompt: 'delete',
|
||||
confirm: () => {
|
||||
this.listing = this.listing.filter(item => item.name !== this.name)
|
||||
|
||||
if (this.hasNext) {
|
||||
this.next()
|
||||
} else if (!this.hasPrevious && !this.hasNext) {
|
||||
this.close()
|
||||
} else {
|
||||
this.prev()
|
||||
}
|
||||
if (this.hasNext) {
|
||||
this.next()
|
||||
} else if (!this.hasPrevious && !this.hasNext) {
|
||||
this.close()
|
||||
} else {
|
||||
this.prev()
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
prev () {
|
||||
this.hoverNav = false
|
||||
|
||||
@@ -77,23 +77,23 @@ export default {
|
||||
this.clip.on('success', () => {
|
||||
this.$showSuccess(this.$t('success.linkCopied'))
|
||||
})
|
||||
this.$root.$on('share-deleted', this.deleted)
|
||||
},
|
||||
beforeDestroy () {
|
||||
this.clip.destroy()
|
||||
this.$root.$off('share-deleted', this.deleted)
|
||||
},
|
||||
methods: {
|
||||
deleteLink: async function (event, link) {
|
||||
event.preventDefault()
|
||||
this.$store.commit('setHash', {
|
||||
hash: link.hash,
|
||||
path: link.path
|
||||
|
||||
this.$store.commit('showHover', {
|
||||
prompt: 'share-delete',
|
||||
confirm: () => {
|
||||
this.$store.commit('closeHovers')
|
||||
|
||||
api.remove(link.hash)
|
||||
this.links = this.links.filter(item => item.hash !== link.hash)
|
||||
}
|
||||
})
|
||||
this.$store.commit('showHover', 'share-delete')
|
||||
},
|
||||
deleted (hash) {
|
||||
this.links = this.links.filter(item => item.hash !== hash)
|
||||
},
|
||||
humanTime (time) {
|
||||
return moment(time * 1000).fromNow()
|
||||
|
||||
Reference in New Issue
Block a user