import { Injectable } from '@angular/core'; import { Actions } from '@ngrx/effects'; import { Store } from '@ngrx/store'; import { WebsocketService, wsMessage } from '@onepoint-yap/dashboard'; import { NotificationActions } from './notification.actions'; @Injectable() export class NotificationEffects { constructor(private actions$: Actions, private wsService: WebsocketService, private store: Store) { wsService.messages$('notification').subscribe((msg: wsMessage) => { this.store.dispatch( NotificationActions.add({ notification: { title: msg.payload.title, text: msg.payload.text, link: msg.payload.link, read: msg.payload.read, id: msg.id } }) ); }); } }