Add loading state guards to checkPunishment and onSubmit buttons to prevent duplicate actions and update visibility of related variables.
This commit is contained in:
parent
beb5cd496a
commit
a9e9f1f03a
|
|
@ -52,7 +52,8 @@
|
|||
<input matInput placeholder="Discord ID" [(ngModel)]="discordId"
|
||||
minlength="17" maxlength="18" pattern="^[0-9]+$">
|
||||
</mat-form-field>
|
||||
<button mat-raised-button (click)="checkPunishment()" [disabled]="authService.username() == null">
|
||||
<button mat-raised-button (click)="checkPunishment()"
|
||||
[disabled]="punishmentLoading || authService.username() == null">
|
||||
Check punishments
|
||||
</button>
|
||||
</section>
|
||||
|
|
@ -148,7 +149,7 @@
|
|||
}
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<button mat-raised-button (click)="onSubmit()" [disabled]="form.invalid">
|
||||
<button mat-raised-button (click)="onSubmit()" [disabled]="formSubmitting || form.invalid">
|
||||
Submit Appeal
|
||||
</button>
|
||||
</section>
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ export class DiscordAppealComponent implements OnInit {
|
|||
return this.currentPageIndex === this.totalPages.length - 1;
|
||||
}
|
||||
|
||||
private punishmentLoading: boolean = false;
|
||||
protected punishmentLoading: boolean = false;
|
||||
|
||||
protected checkPunishment() {
|
||||
if (this.punishmentLoading) {
|
||||
|
|
@ -180,7 +180,7 @@ export class DiscordAppealComponent implements OnInit {
|
|||
}
|
||||
}
|
||||
|
||||
private formSubmitting: boolean = false;
|
||||
protected formSubmitting: boolean = false;
|
||||
|
||||
private sendForm() {
|
||||
if (this.formSubmitting) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user