feat: add notifications tray component (#1172)

Fixes: #1171
This commit is contained in:
Karan Takalkar
2020-08-04 17:39:11 +05:30
committed by GitHub
parent e1e0af3063
commit 30a354c153
12 changed files with 242 additions and 13 deletions
+30 -1
View File
@@ -3,7 +3,7 @@ import { Injectable } from '@angular/core';
import { HttpClient, HttpParams } from '@angular/common/http';
/** rxjs Imports */
import { Observable } from 'rxjs';
import { Observable, of } from 'rxjs';
/**
* Notification service.
@@ -26,4 +26,33 @@ export class NotificationsService {
return this.http.get('/notifications', { params: httpParams });
}
/**
* @returns {Observable<any>} Notifications.
*/
updateNotifications(): Observable<any> {
return this.http.put('/notifications', { });
}
/**
* @returns {Observable<any>} Mock Unread Notifications for Testing.
*/
getMockUnreadNotification(): Observable<any> {
const date = new Date();
return of({
'totalFilteredRecords': 1,
'pageItems': [
{ 'id': Math.floor(Math.random() * 100),
'objectType': 'client',
'objectId': Math.floor(Math.random() * 10),
'action': 'clientCreated',
'actorId': 2,
'content': 'Client Created',
'isRead': false,
'isSystemGenerated': false,
'createdAt': `${date.toLocaleDateString()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`
}
]
});
}
}