Chore: Move conversationStats to a seperate module (#962)

* Chore: Move conversationStats to a seperate module

* Move toggleTyping to conversationTypingStatus

* Remove unused agentTyping flag

* Fix review comments
This commit is contained in:
Pranav Raj S
2020-06-14 14:07:52 +05:30
committed by GitHub
parent 5ec9af9325
commit 5cb88237f5
16 changed files with 139 additions and 98 deletions

View File

@@ -2,7 +2,6 @@ import Vue from 'vue';
import * as types from '../../mutation-types';
import ConversationApi from '../../../api/inbox/conversation';
import MessageApi from '../../../api/inbox/message';
import FBChannel from '../../../api/channel/fbChannel';
// actions
const actions = {
@@ -26,7 +25,7 @@ const actions = {
const { data } = response.data;
const { payload: chatList, meta: metaData } = data;
commit(types.default.SET_ALL_CONVERSATION, chatList);
commit(types.default.SET_CONV_TAB_META, metaData);
dispatch('conversationStats/set', metaData);
commit(types.default.CLEAR_LIST_LOADING_STATUS);
commit(
`contacts/${types.default.SET_CONTACTS}`,
@@ -171,24 +170,6 @@ const actions = {
commit(types.default.UPDATE_CONVERSATION, conversation);
},
toggleTyping: async ({ commit }, { status, conversationId }) => {
try {
commit(types.default.SET_AGENT_TYPING, { status });
await ConversationApi.toggleTyping({ status, conversationId });
} catch (error) {
// Handle error
}
},
markSeen: async ({ commit }, data) => {
try {
await FBChannel.markSeen(data);
commit(types.default.MARK_SEEN);
} catch (error) {
// Handle error
}
},
markMessagesRead: async ({ commit }, data) => {
setTimeout(() => {
commit(types.default.MARK_MESSAGE_READ, data);
@@ -236,15 +217,6 @@ const actions = {
//
}
},
getConversationStats: async ({ commit }, params) => {
try {
const response = await ConversationApi.meta(params);
commit(types.default.SET_CONV_TAB_META, response.data.meta);
} catch (error) {
// Ignore error
}
},
};
export default actions;