@@ -5,7 +5,7 @@ import { Component, OnInit, OnDestroy, ViewEncapsulation } from '@angular/core';
55import { forkJoin } from 'rxjs' ;
66
77/** Custom Services */
8- import { NotificationsService } from 'app/notifications/notifications.service ' ;
8+ import { NotificationService } from '@fineract/client ' ;
99import { environment } from '../../../environments/environment' ;
1010import { MatIconButton } from '@angular/material/button' ;
1111import { MatTooltip } from '@angular/material/tooltip' ;
@@ -65,12 +65,13 @@ export class NotificationsTrayComponent implements OnInit, OnDestroy {
6565 } ;
6666
6767 /**
68- * @param {NotificationsService } notificationsService Notifications Service
68+ * @param {NotificationService } notificationService Notifications Service
6969 */
70- constructor ( public notificationsService : NotificationsService ) {
70+ constructor ( public notificationService : NotificationService ) {
7171 forkJoin ( [
72- this . notificationsService . getNotifications ( true , 9 ) ,
73- this . notificationsService . getNotifications ( false , 9 ) ] ) . subscribe ( ( response : any [ ] ) => {
72+ this . notificationService . getAllNotifications ( { isRead : true , limit : 9 } ) ,
73+ this . notificationService . getAllNotifications ( { isRead : false , limit : 9 } )
74+ ] ) . subscribe ( ( response : any [ ] ) => {
7475 this . readNotifications = response [ 0 ] . pageItems ;
7576 this . unreadNotifications = response [ 1 ] . pageItems ;
7677 this . setNotifications ( ) ;
@@ -101,7 +102,7 @@ export class NotificationsTrayComponent implements OnInit, OnDestroy {
101102 * Recursively fetch unread notifications.
102103 */
103104 fetchUnreadNotifications ( ) {
104- this . notificationsService . getNotifications ( false , 9 ) . subscribe ( ( response : any ) => {
105+ this . notificationService . getAllNotifications ( { isRead : false , limit : 9 } ) . subscribe ( ( response : any ) => {
105106 this . unreadNotifications = this . unreadNotifications . concat ( response . pageItems ) ;
106107 this . setNotifications ( ) ;
107108 } ) ;
@@ -116,7 +117,7 @@ export class NotificationsTrayComponent implements OnInit, OnDestroy {
116117 */
117118 menuClosed ( ) {
118119 // Update the server for read notifications.
119- this . notificationsService . updateNotifications ( ) . subscribe ( ( ) => { } ) ;
120+ this . notificationService . getAllNotifications ( { isRead : true } ) . subscribe ( ( ) => { } ) ;
120121 // Update locally for read notifications.
121122 this . readNotifications = this . unreadNotifications . concat ( this . readNotifications ) ;
122123 this . unreadNotifications = [ ] ;
@@ -127,7 +128,7 @@ export class NotificationsTrayComponent implements OnInit, OnDestroy {
127128 * Function to test notifications in case of faulty backend.
128129 */
129130 mockNotifications ( ) {
130- this . notificationsService . getMockUnreadNotification ( ) . subscribe ( ( response : any ) => {
131+ this . notificationService . getAllNotifications ( { isRead : false , limit : 9 } ) . subscribe ( ( response : any ) => {
131132 this . unreadNotifications = this . unreadNotifications . concat ( response . pageItems ) ;
132133 this . setNotifications ( ) ;
133134 } ) ;
0 commit comments