export class UserNotificationsComponent implements OnInit {
@Input() ignoreLoadingBar = false
@Input() infiniteScroll = true
+ @Input() itemsPerPage = 20
notifications: UserNotification[] = []
// So we can access it in the template
UserNotificationType = UserNotificationType
- componentPagination: ComponentPagination = {
- currentPage: 1,
- itemsPerPage: 20,
- totalItems: null
- }
+ componentPagination: ComponentPagination
constructor (
private userNotificationService: UserNotificationService,
) { }
ngOnInit () {
+ this.componentPagination = {
+ currentPage: 1,
+ itemsPerPage: this.itemsPerPage, // Reset items per page, because of the @Input() variable
+ totalItems: null
+ }
+
this.loadMoreNotifications()
}
}
markAsRead (notification: UserNotification) {
+ if (notification.read) return
+
this.userNotificationService.markAsRead(notification)
.subscribe(
() => {