Fixed form error in update profil page
This commit is contained in:
@@ -1,24 +1,28 @@
|
||||
import {Component} from '@angular/core';
|
||||
import {UserInfo} from "../../interfaces/user.interface";
|
||||
import {ProfilForm} from "../profil-form/profil-form";
|
||||
import {ModalNav} from "../modal-nav/modal-nav";
|
||||
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: [
|
||||
ProfilForm,
|
||||
ModalNav
|
||||
],
|
||||
imports: [],
|
||||
templateUrl: './profil.html',
|
||||
styleUrl: './profil.css',
|
||||
})
|
||||
export class Profil {
|
||||
data: UserInfo =
|
||||
{
|
||||
name: 'Mathys Sanchez Vendé',
|
||||
email: 'mathys.sanchez@vende.fr',
|
||||
fonction: 'admin',
|
||||
};
|
||||
export class Profil implements OnInit {
|
||||
private notificationService = inject(NzNotificationService);
|
||||
private userService = inject(UserService);
|
||||
|
||||
user = signal<GetUserDto>({});
|
||||
|
||||
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 '?';
|
||||
|
||||
Reference in New Issue
Block a user