From f8a0e1e167bd52273c1ff8f21bec328b47cb428b Mon Sep 17 00:00:00 2001 From: Willem Dantuma Date: Mon, 8 Mar 2021 08:45:13 +0100 Subject: [PATCH] Add SetUnreadNotifications action --- projects/common/src/fm/actions/app-common.actions.ts | 12 +++++++++++- .../common/src/fm/reducers/app-common.reducer.ts | 4 ++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/projects/common/src/fm/actions/app-common.actions.ts b/projects/common/src/fm/actions/app-common.actions.ts index 99955f9..7cde408 100644 --- a/projects/common/src/fm/actions/app-common.actions.ts +++ b/projects/common/src/fm/actions/app-common.actions.ts @@ -76,6 +76,8 @@ export const OFFLINE = '[AppCommon] Offline'; export const SETPAGEMODE = '[AppCommon] SetPageMode'; +export const SETUNREADNOTIFICATIONS = '[AppCommon] SetUnreadNotifications'; + export class InitUser implements Action { readonly type = INITUSER; @@ -338,6 +340,13 @@ export class SetPageMode implements Action { constructor(public pageMode:boolean) {} } + +export class SetUnreadNotifications implements Action { + readonly type = SETUNREADNOTIFICATIONS; + + constructor(public unread:number) {} + +} export type Actions = OpenModal @@ -382,6 +391,7 @@ export type Actions = OpenModal | ToggleAppMenu | ToggleNotificationMenu | ToggleHelpMenu - | NotificationEvent; + | NotificationEvent + | SetUnreadNotifications; diff --git a/projects/common/src/fm/reducers/app-common.reducer.ts b/projects/common/src/fm/reducers/app-common.reducer.ts index 6242fbb..bc5dcbb 100644 --- a/projects/common/src/fm/reducers/app-common.reducer.ts +++ b/projects/common/src/fm/reducers/app-common.reducer.ts @@ -164,6 +164,10 @@ export function reducer(state = initialState, action: appCommonActions.Actions ) } return tassign(state,{unreadNotifications:unread}); } + case appCommonActions.SETUNREADNOTIFICATIONS: { + let a = action as appCommonActions.SetUnreadNotifications; + return tassign(state,{unreadNotifications:a.unread}); + } default: { return state; }