Bug: Force fetch inbox settings on route change (#400)

This commit is contained in:
Pranav Raj S 2019-12-30 11:53:16 +05:30 committed by GitHub
parent bacc0b2f18
commit 7c4cc68561
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -104,16 +104,27 @@ export default {
return createMessengerScript(this.inbox.page_id); return createMessengerScript(this.inbox.page_id);
}, },
}, },
watch: {
$route(to) {
if (to.name === 'settings_inbox_show') {
this.fetchInboxSettings();
}
},
},
mounted() { mounted() {
this.$store.dispatch('agents/get'); this.fetchInboxSettings();
this.$store.dispatch('inboxes/get').then(() => {
this.fetchAttachedAgents();
});
}, },
methods: { methods: {
showAlert(message) { showAlert(message) {
bus.$emit('newToastMessage', message); bus.$emit('newToastMessage', message);
}, },
fetchInboxSettings() {
this.selectedAgents = [];
this.$store.dispatch('agents/get');
this.$store.dispatch('inboxes/get').then(() => {
this.fetchAttachedAgents();
});
},
async fetchAttachedAgents() { async fetchAttachedAgents() {
try { try {
const response = await this.$store.dispatch('inboxMembers/get', { const response = await this.$store.dispatch('inboxMembers/get', {