import {Component, inject, OnInit, signal} from '@angular/core'; import {NzNotificationService} from "ng-zorro-antd/notification"; import {GetUserDto, UserService} from "../../services/api"; import {firstValueFrom} from "rxjs"; @Component({ selector: 'app-profil', imports: [], templateUrl: './profil.html', styleUrl: './profil.css', }) export class Profil implements OnInit { private notificationService = inject(NzNotificationService); private userService = inject(UserService); user = signal({}); async ngOnInit() { try { const user = await firstValueFrom(this.userService.getUserEndpoint()); this.user.set(user); } catch { this.notificationService.error('Erreur', 'Impossible de charger l\'utilisateur'); } } getInitial(name: string): string { if (!name || name.trim() === '') return '?'; return name[0].toUpperCase(); } }