From b685361a34da89de1e04c2ce332e1f587bb82cd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Thu, 2 Jan 2020 19:33:10 +0100 Subject: [PATCH] Add action store to delete a conversation by token MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Daniel Calviño Sánchez --- src/store/conversationsStore.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/store/conversationsStore.js b/src/store/conversationsStore.js index f758da753..271ea4be5 100644 --- a/src/store/conversationsStore.js +++ b/src/store/conversationsStore.js @@ -54,10 +54,10 @@ const mutations = { /** * Deletes a conversation from the store. * @param {object} state current store state; - * @param {object} conversation the message; + * @param {object} token the token of the conversation to delete; */ - deleteConversation(state, conversation) { - Vue.delete(state.conversations, conversation.token) + deleteConversation(state, token) { + Vue.delete(state.conversations, token) }, /** * Resets the store to it's original state @@ -99,8 +99,19 @@ const actions = { * @param {object} conversation the conversation to be deleted; */ deleteConversation(context, conversation) { - context.commit('deleteConversation', conversation) + context.commit('deleteConversation', conversation.token) }, + + /** + * Delete a object + * + * @param {object} context default store context; + * @param {object} token the token of the conversation to be deleted; + */ + deleteConversationByToken(context, token) { + context.commit('deleteConversation', token) + }, + /** * Resets the store to it's original state. * @param {object} context default store context;