Restructure event destroy and request abort code

This commit is contained in:
Jože Fortun
2023-08-22 16:50:14 +02:00
parent 95ae09e80c
commit de431aea6c
23 changed files with 237 additions and 160 deletions
@@ -218,15 +218,12 @@ export default {
created () {
this.checkIfMobile()
this.$root.$on('close-sidebar', () => {
this.isExpanded = false
this.isPinned = false
})
this.$root.$on('close-sidebar', this.closeSidebar)
window.addEventListener('resize', this.checkIfMobile)
},
beforeDestroy () {
this.$root.$off('close-sidebar')
this.$root.$off('close-sidebar', this.closeSidebar)
window.removeEventListener('resize', this.checkIfMobile)
},
@@ -330,7 +330,16 @@ export default {
mounted () {
this.searchUsers('', () => {})
this.$root.$on(modalOpenEventName, ({ resource, title, target, allSpecific }) => {
this.$root.$on(modalOpenEventName, this.loadModal)
},
beforeDestroy () {
this.setDefaultValues()
this.destroyEvents()
},
methods: {
loadModal ({ resource, title, target, allSpecific }) {
this.resource = resource
this.title = title
this.target = target
@@ -364,16 +373,8 @@ export default {
})
}
})
},
})
},
beforeDestroy () {
this.setDefaultValues()
this.destroyEvents()
},
methods: {
onHide () {
this.clear()
},