import { Component, OnInit } from '@angular/core'; import { UserDashboardService, UserDTO } from 'src/api'; import { NotificationService } from 'src/app/notification.service'; @Component({ selector: 'app-user-dashboard', templateUrl: './user-dashboard.component.pug', styleUrls: ['./user-dashboard.component.scss'] }) export class UserDashboardComponent implements OnInit { user: UserDTO; constructor( private userDashboardService: UserDashboardService, private notificationService: NotificationService) { } async ngOnInit(): Promise<void> { this.notificationService.showLoading(); const result = await this.userDashboardService.getUserDashboard({}).toPromise(); this.user = result.user; this.notificationService.hideLoading(); } }
import { Component, OnInit } from '@angular/core'; import { UserDashboardService, UserDTO } from 'src/api'; import { NotificationService } from 'src/app/notification.service'; @Component({ selector: 'app-user-dashboard', templateUrl: './user-dashboard.component.pug', styleUrls: ['./user-dashboard.component.scss'] }) export class UserDashboardComponent implements OnInit { user: UserDTO; constructor( private userDashboardService: UserDashboardService, private notificationService: NotificationService) { } ngOnInit(): void { this.notificationService.showLoading(); this.userDashboardService.getUserDashboard({}).subscribe(result => { this.user = result.user; this.notificationService.hideLoading(); }); } }