feat: 🎸 Notifications sorted by modified, then created date (#151)

This commit is contained in:
Johan Öbrink 2021-10-01 09:24:25 +02:00 committed by GitHub
parent 4a0841a704
commit 91f63e8d2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -26,5 +26,11 @@ export const notification = ({
type,
})
const notificationsSort = (item1: Notification, item2: Notification): number => {
const m1 = item1.dateModified || item1.dateCreated
const m2 = item2.dateModified || item2.dateCreated
return m1 < m2 ? 1 : -1
}
export const notifications = (data: any): Notification[] =>
etjanst(data).map(notification)
etjanst(data).map(notification).sort(notificationsSort)