aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-main/users/user-notification.service.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/shared-main/users/user-notification.service.ts')
-rw-r--r--client/src/app/shared/shared-main/users/user-notification.service.ts14
1 files changed, 11 insertions, 3 deletions
diff --git a/client/src/app/shared/shared-main/users/user-notification.service.ts b/client/src/app/shared/shared-main/users/user-notification.service.ts
index 8dd9472fe..ecc66ecdb 100644
--- a/client/src/app/shared/shared-main/users/user-notification.service.ts
+++ b/client/src/app/shared/shared-main/users/user-notification.service.ts
@@ -5,6 +5,7 @@ import { ComponentPaginationLight, RestExtractor, RestService, User, UserNotific
5import { ResultList, UserNotification as UserNotificationServer, UserNotificationSetting } from '@shared/models' 5import { ResultList, UserNotification as UserNotificationServer, UserNotificationSetting } from '@shared/models'
6import { environment } from '../../../../environments/environment' 6import { environment } from '../../../../environments/environment'
7import { UserNotification } from './user-notification.model' 7import { UserNotification } from './user-notification.model'
8import { SortMeta } from 'primeng/api'
8 9
9@Injectable() 10@Injectable()
10export class UserNotificationService { 11export class UserNotificationService {
@@ -18,9 +19,16 @@ export class UserNotificationService {
18 private userNotificationSocket: UserNotificationSocket 19 private userNotificationSocket: UserNotificationSocket
19 ) {} 20 ) {}
20 21
21 listMyNotifications (pagination: ComponentPaginationLight, unread?: boolean, ignoreLoadingBar = false) { 22 listMyNotifications (parameters: {
23 pagination: ComponentPaginationLight
24 ignoreLoadingBar?: boolean
25 unread?: boolean,
26 sort?: SortMeta
27 }) {
28 const { pagination, ignoreLoadingBar, unread, sort } = parameters
29
22 let params = new HttpParams() 30 let params = new HttpParams()
23 params = this.restService.addRestGetParams(params, this.restService.componentPaginationToRestPagination(pagination)) 31 params = this.restService.addRestGetParams(params, this.restService.componentPaginationToRestPagination(pagination), sort)
24 32
25 if (unread) params = params.append('unread', `${unread}`) 33 if (unread) params = params.append('unread', `${unread}`)
26 34
@@ -35,7 +43,7 @@ export class UserNotificationService {
35 } 43 }
36 44
37 countUnreadNotifications () { 45 countUnreadNotifications () {
38 return this.listMyNotifications({ currentPage: 1, itemsPerPage: 0 }, true) 46 return this.listMyNotifications({ pagination: { currentPage: 1, itemsPerPage: 0 }, ignoreLoadingBar: true, unread: true })
39 .pipe(map(n => n.total)) 47 .pipe(map(n => n.total))
40 } 48 }
41 49