mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-05-31 12:15:51 -04:00
27 lines
654 B
TypeScript
27 lines
654 B
TypeScript
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',
|
|
styleUrls: ['./toasts.component.scss']
|
|
})
|
|
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)
|
|
}
|
|
|
|
}
|