Add loading state guards to checkPunishment and onSubmit buttons to prevent duplicate actions and update visibility of related variables.

This commit is contained in:
akastijn 2025-11-24 01:55:13 +01:00
parent beb5cd496a
commit a9e9f1f03a
2 changed files with 5 additions and 4 deletions

View File

@ -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>

View File

@ -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) {