fix: Remove duplicate API calls for conversation (#1419)
This commit is contained in:
parent
9d2542eecd
commit
2d70131097
2 changed files with 12 additions and 7 deletions
|
@ -184,7 +184,9 @@ export default {
|
|||
this.fetchConversations();
|
||||
},
|
||||
fetchConversations() {
|
||||
this.$store.dispatch('fetchAllConversations', this.conversationFilters);
|
||||
this.$store
|
||||
.dispatch('fetchAllConversations', this.conversationFilters)
|
||||
.then(() => this.$emit('conversation-load'));
|
||||
},
|
||||
updateAssigneeTab(selectedTab) {
|
||||
if (this.activeAssigneeTab !== selectedTab) {
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
<template>
|
||||
<section class="app-content columns">
|
||||
<chat-list :conversation-inbox="inboxId" :label="label">
|
||||
<chat-list
|
||||
:conversation-inbox="inboxId"
|
||||
:label="label"
|
||||
@conversation-load="onConversationLoad"
|
||||
>
|
||||
<button class="search--button" @click="onSearch">
|
||||
<i class="ion-ios-search-strong search--icon" />
|
||||
<div class="text-truncate">
|
||||
|
@ -83,24 +87,23 @@ export default {
|
|||
|
||||
mounted() {
|
||||
this.$store.dispatch('agents/get');
|
||||
|
||||
this.initialize();
|
||||
this.fetchConversation();
|
||||
|
||||
this.$watch('$store.state.route', () => this.initialize());
|
||||
this.$watch('chatList.length', () => {
|
||||
this.fetchConversation();
|
||||
this.setActiveChat();
|
||||
});
|
||||
},
|
||||
|
||||
methods: {
|
||||
onConversationLoad() {
|
||||
this.fetchConversationIfUnavailable();
|
||||
},
|
||||
initialize() {
|
||||
this.$store.dispatch('setActiveInbox', this.inboxId);
|
||||
this.setActiveChat();
|
||||
},
|
||||
|
||||
fetchConversation() {
|
||||
fetchConversationIfUnavailable() {
|
||||
if (!this.conversationId) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue