feat: Create modal to merge two contacts (#2457)
This commit is contained in:
committed by
GitHub
parent
6c3e2a0bd3
commit
b33701a666
@@ -4,6 +4,7 @@ import {
|
||||
} from 'shared/helpers/CustomErrors';
|
||||
import types from '../../mutation-types';
|
||||
import ContactAPI from '../../../api/contacts';
|
||||
import AccountActionsAPI from '../../../api/accountActions';
|
||||
|
||||
export const actions = {
|
||||
search: async ({ commit }, { search, page, sortAttr, label }) => {
|
||||
@@ -137,6 +138,18 @@ export const actions = {
|
||||
commit(types.SET_CONTACT_ITEM, data);
|
||||
},
|
||||
|
||||
merge: async ({ commit }, { childId, parentId }) => {
|
||||
commit(types.SET_CONTACT_UI_FLAG, { isMerging: true });
|
||||
try {
|
||||
const response = await AccountActionsAPI.merge(parentId, childId);
|
||||
commit(types.SET_CONTACT_ITEM, response.data);
|
||||
} catch (error) {
|
||||
throw new Error(error);
|
||||
} finally {
|
||||
commit(types.SET_CONTACT_UI_FLAG, { isMerging: false });
|
||||
}
|
||||
},
|
||||
|
||||
deleteContactThroughConversations: ({ commit }, id) => {
|
||||
commit(types.DELETE_CONTACT, id);
|
||||
commit(types.CLEAR_CONTACT_CONVERSATIONS, id, { root: true });
|
||||
|
||||
Reference in New Issue
Block a user