diff --git a/src/components/CreateGroupDialog.vue b/src/components/CreateGroupDialog.vue index ee37fb0b2..326107643 100644 --- a/src/components/CreateGroupDialog.vue +++ b/src/components/CreateGroupDialog.vue @@ -33,26 +33,26 @@ import { Modal } from "bootstrap"; export default { + beforeRouteLeave(to, from, next) { + this.cleanupModal(); + next(); + }, props: {}, emits: [ "added" ], data: () => ({ modal: null, groupName: null, }), - mounted() { - this.modal = new Modal(this.$refs.modal); - }, watch: { $route(to, from) { this.cleanupModal(); } }, - beforeUnmount() { - this.cleanupModal(); + mounted() { + this.modal = new Modal(this.$refs.modal); }, - beforeRouteLeave(to, from, next) { + beforeUnmount() { this.cleanupModal(); - next(); }, methods: { /** diff --git a/src/components/ProxyDialog.vue b/src/components/ProxyDialog.vue index 8c212f265..a6f6cce5a 100644 --- a/src/components/ProxyDialog.vue +++ b/src/components/ProxyDialog.vue @@ -105,6 +105,10 @@ export default { components: { Confirm, }, + beforeRouteLeave(to, from, next) { + this.cleanupModal(); + next(); + }, props: {}, emits: [ "added" ], data() { @@ -125,26 +129,17 @@ export default { } }; }, - - mounted() { - this.modal = new Modal(this.$refs.modal); - }, - - beforeRouteLeave(to, from, next) { - this.cleanupModal(); - next(); - }, - watch: { $route(to, from) { this.cleanupModal(); } }, - + mounted() { + this.modal = new Modal(this.$refs.modal); + }, beforeUnmount() { this.cleanupModal(); }, - methods: { /** * Show dialog to confirm deletion diff --git a/src/components/TagsManager.vue b/src/components/TagsManager.vue index b4938304a..2cc3549c9 100644 --- a/src/components/TagsManager.vue +++ b/src/components/TagsManager.vue @@ -155,6 +155,10 @@ export default { Tag, VueMultiselect, }, + beforeRouteLeave(to, from, next) { + this.cleanupModal(); + next(); + }, props: { /** * Array of tags to be pre-selected @@ -244,21 +248,15 @@ export default { }; }, }, - mounted() { - this.modal = new Modal(this.$refs.modal); - this.getExistingTags(); - }, - beforeRouteLeave(to, from, next) { - this.cleanupModal(); - next(); - }, - watch: { $route(to, from) { this.cleanupModal(); } }, - + mounted() { + this.modal = new Modal(this.$refs.modal); + this.getExistingTags(); + }, beforeUnmount() { this.cleanupModal(); },