2020-10-27 01:10:18 +01:00
|
|
|
import { Component, OnDestroy, OnInit } from '@angular/core';
|
|
|
|
|
import { Subscription } from 'rxjs';
|
|
|
|
|
import { Toast, ToastService } from 'src/app/services/toast.service';
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'app-toasts',
|
|
|
|
|
templateUrl: './toasts.component.html',
|
2020-11-22 14:43:59 +01:00
|
|
|
styleUrls: ['./toasts.component.scss']
|
2020-10-27 01:10:18 +01:00
|
|
|
})
|
|
|
|
|
export class ToastsComponent implements OnInit, OnDestroy {
|
|
|
|
|
|
|
|
|
|
constructor(private toastService: ToastService) { }
|
|
|
|
|
|
|
|
|
|
subscription: Subscription
|
|
|
|
|
|
|
|
|
|
toasts: Toast[] = []
|
|
|
|
|
|
|
|
|
|
ngOnDestroy(): void {
|
|
|
|
|
this.subscription.unsubscribe()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ngOnInit(): void {
|
|
|
|
|
this.subscription = this.toastService.getToasts().subscribe(toasts => this.toasts = toasts)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|