paperless-ngx/src-ui/src/app/components/common/toasts/toasts.component.ts

27 lines
667 B
TypeScript
Raw Normal View History

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