Refactor code

This commit is contained in:
2026-05-28 10:52:46 +01:00
parent 7041c5335b
commit d37ff4ace4
31 changed files with 132 additions and 353 deletions
+5 -14
View File
@@ -26,7 +26,7 @@ export class User {
async onModalOk() {
await this.addUser()
this.createUser().profilForm.reset();
this.modal().isVisible = false;
this.onModalCancel();
await this.usersTable().fetchUsers()
}
@@ -36,24 +36,15 @@ export class User {
async addUser() {
if (this.createUser().profilForm.invalid) {
this.notificationService.error(
'Erreur',
'Erreur d\'écriture dans le formulaire'
)
this.notificationService.error('Erreur', 'Formulaire invalide')
}
try {
const users = this.createUser().profilForm.getRawValue();
await firstValueFrom(this.usersService.createUserEndpoint(users))
this.notificationService.success(
'Success',
'Utilisateur crée'
)
} catch (e) {
this.notificationService.error(
'Erreur',
'Erreur d\'enregistrement'
)
this.notificationService.success('Success', 'Utilisateur crée')
} catch {
this.notificationService.error('Erreur', 'Erreur d\'enregistrement')
}
}
}