From 7c4cc68561a019cb95058b2ea89f598cf95aae54 Mon Sep 17 00:00:00 2001 From: Pranav Raj S Date: Mon, 30 Dec 2019 11:53:16 +0530 Subject: [PATCH] Bug: Force fetch inbox settings on route change (#400) --- .../dashboard/settings/inbox/Settings.vue | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/app/javascript/dashboard/routes/dashboard/settings/inbox/Settings.vue b/app/javascript/dashboard/routes/dashboard/settings/inbox/Settings.vue index 3f77580e9..3c5954233 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/inbox/Settings.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/inbox/Settings.vue @@ -104,16 +104,27 @@ export default { return createMessengerScript(this.inbox.page_id); }, }, + watch: { + $route(to) { + if (to.name === 'settings_inbox_show') { + this.fetchInboxSettings(); + } + }, + }, mounted() { - this.$store.dispatch('agents/get'); - this.$store.dispatch('inboxes/get').then(() => { - this.fetchAttachedAgents(); - }); + this.fetchInboxSettings(); }, methods: { showAlert(message) { bus.$emit('newToastMessage', message); }, + fetchInboxSettings() { + this.selectedAgents = []; + this.$store.dispatch('agents/get'); + this.$store.dispatch('inboxes/get').then(() => { + this.fetchAttachedAgents(); + }); + }, async fetchAttachedAgents() { try { const response = await this.$store.dispatch('inboxMembers/get', {