Add action store to delete a conversation by token

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Daniel Calviño Sánchez 2020-01-02 19:33:10 +01:00
Родитель 19ed07e749
Коммит b685361a34
1 изменённых файлов: 15 добавлений и 4 удалений

Просмотреть файл

@ -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;