diff --git a/ui/src/actions/MessageAction.js b/ui/src/actions/MessageAction.js index 92dd3fc..a05d600 100644 --- a/ui/src/actions/MessageAction.js +++ b/ui/src/actions/MessageAction.js @@ -35,13 +35,13 @@ function newMessages(id, data) { export function deleteMessagesByApp(id) { if (id === -1) { axios.delete(config.get('url') + 'message').then(() => { - dispatcher.dispatch({type: 'DELETE_MESSAGES', id: -1}); + dispatcher.dispatch({type: 'DELETE_MESSAGES', payload: -1}); snack('Messages deleted'); }); } else { axios.delete(config.get('url') + 'application/' + id + '/message') .then(() => { - dispatcher.dispatch({type: 'DELETE_MESSAGES', id}); + dispatcher.dispatch({type: 'DELETE_MESSAGES', payload: id}); snack('Deleted all messages from the application'); }); } diff --git a/ui/src/stores/MessageStore.js b/ui/src/stores/MessageStore.js index c118187..9cc9ad1 100644 --- a/ui/src/stores/MessageStore.js +++ b/ui/src/stores/MessageStore.js @@ -58,6 +58,15 @@ class MessageStore extends EventEmitter { } }); this.emit('change'); + } else if (data.type === 'DELETE_MESSAGES') { + const id = data.payload; + if (id === -1) { + this.appToMessages = {}; + } else { + delete this.appToMessages[-1]; + delete this.appToMessages[id]; + } + this.emit('change'); } }