chore: remove prompts events

This commit is contained in:
Ramires Viana
2021-03-04 14:40:18 +00:00
parent edb9e85efd
commit 2a1f759e9e
4 changed files with 31 additions and 42 deletions

View File

@@ -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()