Enhancement: Paginate conversation calls in tabs (#560)

* Use conversationPage module for pagination

* Load more conversations

* Reset list if conversation status is changed

* Add specs to conversationPage

* Reset filter when page is re-mounted

* Update text

* Update text
This commit is contained in:
Pranav Raj S
2020-02-26 21:15:01 +05:30
committed by GitHub
parent e5bc372a29
commit 0740d4762f
28 changed files with 395 additions and 141 deletions

View File

@@ -7,7 +7,7 @@ import FBChannel from '../../../api/channel/fbChannel';
// actions
const actions = {
fetchAllConversations: async ({ commit }, params) => {
fetchAllConversations: async ({ commit, dispatch }, params) => {
commit(types.default.SET_LIST_LOADING_STATUS);
try {
const response = await ConversationApi.get(params);
@@ -16,6 +16,21 @@ const actions = {
commit(types.default.SET_ALL_CONVERSATION, chatList);
commit(types.default.SET_CONV_TAB_META, metaData);
commit(types.default.CLEAR_LIST_LOADING_STATUS);
dispatch(
'conversationPage/setCurrentPage',
{
filter: params.assigneeType,
page: params.page,
},
{ root: true }
);
if (!chatList.length) {
dispatch(
'conversationPage/setEndReached',
{ filter: params.assigneeType },
{ root: true }
);
}
} catch (error) {
// Handle error
}

View File

@@ -2,9 +2,9 @@
/* eslint no-param-reassign: 0 */
import Vue from 'vue';
import * as types from '../../mutation-types';
import wootConstants from '../../../constants';
import getters, { getSelectedChatConversation } from './getters';
import actions from './actions';
import wootConstants from '../../../constants';
const state = {
allConversations: [],
@@ -22,7 +22,7 @@ const state = {
dataFetched: false,
},
listLoadingStatus: true,
chatStatusFilter: wootConstants.ASSIGNEE_TYPE_SLUG.OPEN,
chatStatusFilter: wootConstants.STATUS_TYPE.OPEN,
currentInbox: null,
};