feat: Add Bulk actions to conversations (#4647)

Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
This commit is contained in:
Fayaz Ahmed
2022-06-03 11:12:22 +05:30
committed by GitHub
parent 43a0b4c039
commit 79a525aa62
21 changed files with 693 additions and 12 deletions

View File

@@ -0,0 +1,44 @@
import types from '../mutation-types';
import BulkActionsAPI from '../../api/bulkActions';
export const state = {
uiFlags: {
isUpdating: false,
},
};
export const getters = {
getUIFlags(_state) {
return _state.uiFlags;
},
};
export const actions = {
process: async function processAction({ commit }, payload) {
commit(types.SET_BULK_ACTIONS_FLAG, { isUpdating: true });
try {
await BulkActionsAPI.create(payload);
} catch (error) {
throw new Error(error);
} finally {
commit(types.SET_BULK_ACTIONS_FLAG, { isUpdating: false });
}
},
};
export const mutations = {
[types.SET_BULK_ACTIONS_FLAG](_state, data) {
_state.uiFlags = {
..._state.uiFlags,
...data,
};
},
};
export default {
namespaced: true,
actions,
state,
getters,
mutations,
};