diff --git a/angular.json b/angular.json index 860ff910..954e1da9 100644 --- a/angular.json +++ b/angular.json @@ -144,7 +144,8 @@ "cli": { "schematicCollections": [ "@angular-eslint/schematics" - ] + ], + "analytics": false }, "schematics": { "@angular-eslint/schematics:application": { diff --git a/src/app/user/edit-user/edit-user.component.html b/src/app/user/edit-user/edit-user.component.html index 508b1344..8877c3c8 100644 --- a/src/app/user/edit-user/edit-user.component.html +++ b/src/app/user/edit-user/edit-user.component.html @@ -18,13 +18,7 @@ - - Email is required - Input must be an email + diff --git a/src/app/user/edit-user/edit-user.component.ts b/src/app/user/edit-user/edit-user.component.ts index 4f6ab5b8..9906285c 100644 --- a/src/app/user/edit-user/edit-user.component.ts +++ b/src/app/user/edit-user/edit-user.component.ts @@ -56,13 +56,8 @@ export class EditUserComponent implements OnInit, OnChanges { } public userDetailsForm: FormGroup<{ - email: FormControl; password: FormControl; }> = new FormGroup({ - email: new FormControl(this.user.email, { - validators: [Validators.required, Validators.email], - nonNullable: true, - }), password: new FormControl('', { nonNullable: true }), }); @@ -74,37 +69,34 @@ export class EditUserComponent implements OnInit, OnChanges { saveDetails() { this.saving = true; - var email = this.userDetailsForm.controls.email.value; var password = this.userDetailsForm.controls.password.value; - if (email == null) { - email = ''; - } - if (password == null) { password = ''; } - this.userService.saveUser(this.user.id, email, password).subscribe({ - next: (_s: ServerResponse) => { - this.alertText = 'User updated'; - this.alertType = 'success'; - this.alertClosed = false; - this.saving = false; - setTimeout(() => { - this.alertClosed = true; - }, 2000); - }, - error: (s: ServerResponse) => { - this.alertText = 'Error updating user: ' + s.message; - this.alertType = 'danger'; - this.alertClosed = false; - this.saving = false; - setTimeout(() => { - this.alertClosed = true; - }, 2000); - }, - }); + this.userService + .saveUser(this.user.id, this.user.email, password) + .subscribe({ + next: (_s: ServerResponse) => { + this.alertText = 'User updated'; + this.alertType = 'success'; + this.alertClosed = false; + this.saving = false; + setTimeout(() => { + this.alertClosed = true; + }, 2000); + }, + error: (s: ServerResponse) => { + this.alertText = 'Error updating user: ' + s.message; + this.alertType = 'danger'; + this.alertClosed = false; + this.saving = false; + setTimeout(() => { + this.alertClosed = true; + }, 2000); + }, + }); } delete() {