diff --git a/src/app/components/user-table/user-table.ts b/src/app/components/user-table/user-table.ts index 76ab53b..6c2af93 100644 --- a/src/app/components/user-table/user-table.ts +++ b/src/app/components/user-table/user-table.ts @@ -27,9 +27,7 @@ import {NzIconDirective} from "ng-zorro-antd/icon"; export class UserTable implements OnInit { private usersService = inject(UsersService); private notificationService = inject(NzNotificationService) - users = signal([]); - usersLoading = signal(false); async ngOnInit() { diff --git a/src/app/pages/user/user.ts b/src/app/pages/user/user.ts index 2b2a90a..cac50ce 100644 --- a/src/app/pages/user/user.ts +++ b/src/app/pages/user/user.ts @@ -17,18 +17,13 @@ import { format } from 'date-fns'; templateUrl: './user.html', styleUrl: './user.css', }) -export class User implements OnInit { +export class User { modal = viewChild.required('modal'); createUser = viewChild.required('createUser'); usersTable = viewChild.required('userTable'); - private usersService = inject(UsersService); private notificationService = inject(NzNotificationService) - async ngOnInit() { - await this.addUser(); - } - async onModalOk() { await this.addUser() this.createUser().createUserForm.reset(); @@ -43,7 +38,10 @@ export class User implements OnInit { async addUser() { if (this.createUser().createUserForm.invalid) { - return + this.notificationService.error( + 'Erreur', + 'Erreur d\'écriture dans le formulaire' + ) } try { const rawDate = this.createUser().createUserForm.get('birthDate')?.value;