Petites évolutions
This commit is contained in:
@@ -46,8 +46,7 @@
|
||||
</mat-form-field>
|
||||
</p>
|
||||
|
||||
<button [disabled]="loading" mat-raised-button color="accent">
|
||||
<span *ngIf="loading" class="spinner-border spinner-border-sm mr-1"></span>
|
||||
<button [disabled]="!createForm.valid" mat-raised-button color="accent">
|
||||
Create user and login
|
||||
</button>
|
||||
<div *ngIf="error" class="alert alert-danger mt-3 mb-0">{{error}}</div>
|
||||
|
||||
@@ -14,7 +14,7 @@ import { User } from "../../models/user";
|
||||
})
|
||||
export class CreateUserComponent implements OnInit {
|
||||
createForm: FormGroup;
|
||||
loading = false;
|
||||
invalidForm = true;
|
||||
submitted = false;
|
||||
returnUrl: string;
|
||||
error = "";
|
||||
@@ -55,12 +55,12 @@ export class CreateUserComponent implements OnInit {
|
||||
}
|
||||
|
||||
onCreateSubmit() {
|
||||
this.loading = true;
|
||||
this.invalidForm = false;
|
||||
this.submitted = true;
|
||||
|
||||
// stop here if form is invalid
|
||||
if (this.createForm.invalid) {
|
||||
this.loading = true;
|
||||
this.invalidForm = true;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ export class CreateUserComponent implements OnInit {
|
||||
},
|
||||
error => {
|
||||
this.error = error;
|
||||
this.loading = false;
|
||||
this.invalidForm = false;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user