feat: enable conversation deletion

This commit is contained in:
Sojan Jose
2025-06-04 17:17:40 -05:00
parent ee293c3598
commit 9ae94d3e50
11 changed files with 62 additions and 1 deletions
@@ -327,6 +327,15 @@ const actions = {
}
},
deleteConversation: async ({ commit }, conversationId) => {
try {
await ConversationApi.delete(conversationId);
commit(types.DELETE_CONVERSATION, conversationId);
} catch (error) {
throw new Error(error);
}
},
addConversation({ commit, state, dispatch, rootState }, conversation) {
const { currentInbox, appliedFilters } = state;
const {
@@ -204,6 +204,12 @@ export const mutations = {
_state.allConversations.push(conversation);
},
[types.DELETE_CONVERSATION](_state, conversationId) {
_state.allConversations = _state.allConversations.filter(
c => c.id !== conversationId
);
},
[types.UPDATE_CONVERSATION](_state, conversation) {
const { allConversations } = _state;
const index = allConversations.findIndex(c => c.id === conversation.id);