mirror of
https://github.com/lingble/chatwoot.git
synced 2025-10-30 02:32:29 +00:00
Fixes https://github.com/chatwoot/chatwoot/issues/8436 Fixes https://github.com/chatwoot/chatwoot/issues/9767 Fixes https://github.com/chatwoot/chatwoot/issues/10156 Fixes https://github.com/chatwoot/chatwoot/issues/6031 Fixes https://github.com/chatwoot/chatwoot/issues/5696 Fixes https://github.com/chatwoot/chatwoot/issues/9250 Fixes https://github.com/chatwoot/chatwoot/issues/9762 --------- Co-authored-by: Pranav <pranavrajs@gmail.com> Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
85 lines
1.7 KiB
JavaScript
85 lines
1.7 KiB
JavaScript
import * as types from '../mutation-types';
|
|
|
|
const state = {
|
|
currentPage: {
|
|
me: 0,
|
|
unassigned: 0,
|
|
all: 0,
|
|
appliedFilters: 0,
|
|
},
|
|
hasEndReached: {
|
|
me: false,
|
|
unassigned: false,
|
|
all: false,
|
|
},
|
|
};
|
|
|
|
export const getters = {
|
|
getHasEndReached: $state => filter => {
|
|
return $state.hasEndReached[filter];
|
|
},
|
|
getCurrentPageFilter: $state => filter => {
|
|
return $state.currentPage[filter];
|
|
},
|
|
getCurrentPage: $state => {
|
|
return $state.currentPage;
|
|
},
|
|
};
|
|
|
|
export const actions = {
|
|
setCurrentPage({ commit }, { filter, page }) {
|
|
commit(types.default.SET_CURRENT_PAGE, { filter, page });
|
|
},
|
|
setEndReached({ commit }, { filter }) {
|
|
commit(types.default.SET_CONVERSATION_END_REACHED, { filter });
|
|
},
|
|
reset({ commit }) {
|
|
commit(types.default.CLEAR_CONVERSATION_PAGE);
|
|
},
|
|
};
|
|
|
|
export const mutations = {
|
|
[types.default.SET_CURRENT_PAGE]: ($state, { filter, page }) => {
|
|
$state.currentPage = {
|
|
...$state.currentPage,
|
|
[filter]: page,
|
|
};
|
|
},
|
|
[types.default.SET_CONVERSATION_END_REACHED]: ($state, { filter }) => {
|
|
if (filter === 'all') {
|
|
$state.hasEndReached = {
|
|
...$state.hasEndReached,
|
|
unassigned: true,
|
|
me: true,
|
|
};
|
|
}
|
|
$state.hasEndReached = {
|
|
...$state.hasEndReached,
|
|
[filter]: true,
|
|
};
|
|
},
|
|
[types.default.CLEAR_CONVERSATION_PAGE]: $state => {
|
|
$state.currentPage = {
|
|
me: 0,
|
|
unassigned: 0,
|
|
all: 0,
|
|
appliedFilters: 0,
|
|
};
|
|
|
|
$state.hasEndReached = {
|
|
me: false,
|
|
unassigned: false,
|
|
all: false,
|
|
appliedFilters: false,
|
|
};
|
|
},
|
|
};
|
|
|
|
export default {
|
|
namespaced: true,
|
|
state,
|
|
getters,
|
|
actions,
|
|
mutations,
|
|
};
|