diff options
Diffstat (limited to 'ufund-ui/src/app/app.component.ts')
-rw-r--r-- | ufund-ui/src/app/app.component.ts | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/ufund-ui/src/app/app.component.ts b/ufund-ui/src/app/app.component.ts index df9114e..2f98334 100644 --- a/ufund-ui/src/app/app.component.ts +++ b/ufund-ui/src/app/app.component.ts @@ -1,15 +1,11 @@ -import {Component, OnInit, Inject} from '@angular/core'; +import {Component, OnInit, Inject, ViewContainerRef} from '@angular/core'; import {BehaviorSubject} from 'rxjs'; import { DOCUMENT } from '@angular/common'; import {AuthService} from './services/auth.service'; -import {ToastType} from './services/toasts.service'; +import {ToastsService} from './services/toasts.service'; import {User} from './models/User'; import {ActivatedRoute, Router} from '@angular/router'; -interface ToastProps { - type: ToastType, message: string, action?: {label: string, onAction: () => void} -} - @Component({ selector: 'app-root', templateUrl: './app.component.html', @@ -19,13 +15,13 @@ interface ToastProps { export class AppComponent implements OnInit { // title = 'ufund-ui'; currentUser?: BehaviorSubject<User | null>; - toast = new BehaviorSubject<ToastProps>({type: ToastType.INFO, message: "testToast"}) - constructor( private authService: AuthService, private router: Router, private route: ActivatedRoute, + protected toastService: ToastsService, + private viewContainerRef: ViewContainerRef, @Inject(DOCUMENT) private document: Document ) {} @@ -34,6 +30,7 @@ export class AppComponent implements OnInit { } ngOnInit() { + this.toastService.setRootViewContainerRef(this.viewContainerRef) this.currentUser = this.authService.getCurrentUserSubject() let data = localStorage.getItem("credential"); if (data) { @@ -51,5 +48,4 @@ export class AppComponent implements OnInit { localStorage.removeItem("credential") location.reload() } - } |