chore: inbox member clean up (#2144)

Delete unused logic and tests
Co-authored-by: Nithin David Thomas <webofnithin@gmail.com>
Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
This commit is contained in:
Sivin Varghese
2021-04-27 20:59:00 +05:30
committed by GitHub
parent f1f4a35b2b
commit c10efd2c7b
5 changed files with 0 additions and 152 deletions

View File

@@ -1,44 +1,6 @@
import Vue from 'vue';
import InboxMembersAPI from '../../api/inboxMembers';
const state = {
records: {},
uiFlags: {
isFetching: false,
},
};
export const types = {
SET_INBOX_MEMBERS_UI_FLAG: 'SET_INBOX_MEMBERS_UI_FLAG',
SET_INBOX_MEMBERS: 'SET_INBOX_MEMBERS',
};
export const getters = {
getMembersByInbox: $state => inboxId => {
const allAgents = $state.records[inboxId] || [];
const verifiedAgents = allAgents.filter(record => record.confirmed);
return verifiedAgents;
},
getUIFlags($state) {
return $state.uiFlags;
},
};
export const actions = {
async fetch({ commit }, { inboxId }) {
commit(types.SET_INBOX_MEMBERS_UI_FLAG, { isFetching: true });
try {
const {
data: { payload },
} = await InboxMembersAPI.show(inboxId);
commit(types.SET_INBOX_MEMBERS, { inboxId, members: payload });
} catch (error) {
throw new Error(error);
} finally {
commit(types.SET_INBOX_MEMBERS_UI_FLAG, { isFetching: false });
}
},
get(_, { inboxId }) {
return InboxMembersAPI.show(inboxId);
},
@@ -47,22 +9,7 @@ export const actions = {
},
};
export const mutations = {
[types.SET_INBOX_MEMBERS_UI_FLAG]($state, data) {
$state.uiFlags = {
...$state.uiFlags,
...data,
};
},
[types.SET_INBOX_MEMBERS]: ($state, { inboxId, members }) => {
Vue.set($state.records, inboxId, members);
},
};
export default {
namespaced: true,
state,
getters,
actions,
mutations,
};