Feat: Assign conversations to teams. (#1849)
This commit is contained in:
committed by
GitHub
parent
941d4219f0
commit
c99c63cd79
@@ -103,18 +103,38 @@ const actions = {
|
||||
}
|
||||
},
|
||||
|
||||
assignAgent: async ({ commit }, { conversationId, agentId }) => {
|
||||
assignAgent: async ({ dispatch }, { conversationId, agentId }) => {
|
||||
try {
|
||||
const response = await ConversationApi.assignAgent({
|
||||
conversationId,
|
||||
agentId,
|
||||
});
|
||||
commit(types.default.ASSIGN_AGENT, response.data);
|
||||
dispatch('setCurrentChatAssignee', response.data);
|
||||
} catch (error) {
|
||||
// Handle error
|
||||
}
|
||||
},
|
||||
|
||||
setCurrentChatAssignee({ commit }, assignee) {
|
||||
commit(types.default.ASSIGN_AGENT, assignee);
|
||||
},
|
||||
|
||||
assignTeam: async ({ dispatch }, { conversationId, teamId }) => {
|
||||
try {
|
||||
const response = await ConversationApi.assignTeam({
|
||||
conversationId,
|
||||
teamId,
|
||||
});
|
||||
dispatch('setCurrentChatTeam', response.data);
|
||||
} catch (error) {
|
||||
// Handle error
|
||||
}
|
||||
},
|
||||
|
||||
setCurrentChatTeam({ commit }, team) {
|
||||
commit(types.default.ASSIGN_TEAM, team);
|
||||
},
|
||||
|
||||
toggleStatus: async ({ commit }, data) => {
|
||||
try {
|
||||
const response = await ConversationApi.toggleStatus(data);
|
||||
|
||||
@@ -61,7 +61,12 @@ export const mutations = {
|
||||
|
||||
[types.default.ASSIGN_AGENT](_state, assignee) {
|
||||
const [chat] = getSelectedChatConversation(_state);
|
||||
chat.meta.assignee = assignee;
|
||||
Vue.set(chat.meta, 'assignee', assignee);
|
||||
},
|
||||
|
||||
[types.default.ASSIGN_TEAM](_state, team) {
|
||||
const [chat] = getSelectedChatConversation(_state);
|
||||
Vue.set(chat.meta, 'team', team);
|
||||
},
|
||||
|
||||
[types.default.RESOLVE_CONVERSATION](_state, status) {
|
||||
@@ -145,7 +150,7 @@ export const mutations = {
|
||||
// Update assignee on action cable message
|
||||
[types.default.UPDATE_ASSIGNEE](_state, payload) {
|
||||
const [chat] = _state.allConversations.filter(c => c.id === payload.id);
|
||||
chat.meta.assignee = payload.assignee;
|
||||
Vue.set(chat.meta, 'assignee', payload.assignee);
|
||||
},
|
||||
|
||||
[types.default.UPDATE_CONVERSATION_CONTACT](
|
||||
|
||||
Reference in New Issue
Block a user