diff --git a/app/resources/js/app.js b/app/resources/js/app.js index f7d6b58..ea63c94 100755 --- a/app/resources/js/app.js +++ b/app/resources/js/app.js @@ -195,6 +195,7 @@ const app = new Vue({ this.showApp = true; this.performGatewayConnection(); this.browseCategories(); + Notification.requestPermission(); } else { this.showApp = false; this.snackbarEditButton('Manage', () => { @@ -239,6 +240,9 @@ const app = new Vue({ } if (messageObject.author.username !== this.loggedInUser.username && messageObject.category._id !== this.selection.category._id) { + if (Notification.permission === 'granted') { + new Notification(`${messageObject.category.title}/${messageObject.author.username}`, messageObject.content); + } this.okNotification(`${messageObject.category.title}/${messageObject.author.username}: ${messageObject.content}`); } }, @@ -251,7 +255,7 @@ const app = new Vue({ this.selection.category._id = categoryId; }, sendCurrentMessage: async function() { - const status = this.gateway.sendMessage(this.selection.category._id, this.message.typed); + const status = await this.gateway.sendMessage(this.selection.category._id, this.message.typed); if (status === 1) { this.okNotification('Failed to send message!'); return;