Sorted notifications after concatenation by Roberts suggestion

This commit is contained in:
Wolfgang Huß 2019-09-27 09:56:48 +02:00
parent a57d228c40
commit 1f8cc9ef15

View File

@ -125,7 +125,15 @@ export default {
const newNotifications = data.notifications.filter(newN => {
return !this.displayedNotifications.find(oldN => this.equalNotification(newN, oldN))
})
this.displayedNotifications = newNotifications.concat(this.displayedNotifications)
this.displayedNotifications = newNotifications
.concat(this.displayedNotifications)
.sort((a, b) => {
return a.createdAt === b.createdAt
? 0
: new Date(a.createdAt) < new Date(b.createdAt)
? 1
: -1
})
this.updateOn = false
return data.notifications
},