This commit is contained in:
Nicolas Constant 2020-12-21 21:14:32 -05:00
parent 3c4fc074ef
commit 8c76056747
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
2 changed files with 8 additions and 8 deletions

View File

@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { NotificationService, NotificatioData } from '../../services/notification.service'; import { NotificationService, NotificationData } from '../../services/notification.service';
@Component({ @Component({
selector: 'app-notification-hub', selector: 'app-notification-hub',
@ -12,7 +12,7 @@ export class NotificationHubComponent implements OnInit {
constructor(private notificationService: NotificationService) { } constructor(private notificationService: NotificationService) { }
ngOnInit() { ngOnInit() {
this.notificationService.notifactionStream.subscribe((notification: NotificatioData) => { this.notificationService.notifactionStream.subscribe((notification: NotificationData) => {
let alreadyExistingNotification = this.notifications.find(x => x.avatar === notification.avatar && x.message === notification.message); let alreadyExistingNotification = this.notifications.find(x => x.avatar === notification.avatar && x.message === notification.message);
if(alreadyExistingNotification){ if(alreadyExistingNotification){
@ -40,13 +40,13 @@ export class NotificationHubComponent implements OnInit {
// }, 1500); // }, 1500);
// } // }
onClick(notification: NotificatioData): void{ onClick(notification: NotificationData): void{
this.notifications = this.notifications.filter(x => x.id !== notification.id); this.notifications = this.notifications.filter(x => x.id !== notification.id);
} }
} }
class NotificationWrapper extends NotificatioData { class NotificationWrapper extends NotificationData {
constructor(data: NotificatioData) { constructor(data: NotificationData) {
super(data.avatar, data.errorCode, data.message, data.isError); super(data.avatar, data.errorCode, data.message, data.isError);
} }

View File

@ -10,7 +10,7 @@ import { ToolsService } from './tools.service';
@Injectable() @Injectable()
export class NotificationService { export class NotificationService {
public restartNotificationStream = new Subject<string>(); public restartNotificationStream = new Subject<string>();
public notifactionStream = new Subject<NotificatioData>(); public notifactionStream = new Subject<NotificationData>();
public newRespondPostedStream = new Subject<NewReplyData>(); public newRespondPostedStream = new Subject<NewReplyData>();
public hideAccountUrlStream = new Subject<string>(); public hideAccountUrlStream = new Subject<string>();
public deletedStatusStream = new Subject<StatusWrapper>(); public deletedStatusStream = new Subject<StatusWrapper>();
@ -19,7 +19,7 @@ export class NotificationService {
} }
public notify(avatar: string, errorCode: number, message: string, isError: boolean) { public notify(avatar: string, errorCode: number, message: string, isError: boolean) {
let newNotification = new NotificatioData(avatar, errorCode, message, isError); let newNotification = new NotificationData(avatar, errorCode, message, isError);
this.notifactionStream.next(newNotification); this.notifactionStream.next(newNotification);
} }
@ -70,7 +70,7 @@ export class NotificationService {
} }
} }
export class NotificatioData { export class NotificationData {
public id: string; public id: string;
constructor( constructor(