Fixed waiting for responses in code for certain actions.

This commit is contained in:
Tom 2025-03-18 16:42:44 +00:00
parent d0556dce9c
commit 2f2215b041
3 changed files with 9 additions and 3 deletions

View File

@ -52,6 +52,7 @@ export class GroupItemEditComponent implements OnInit {
if (this.formGroup.invalid || this.waitForResponse) if (this.formGroup.invalid || this.waitForResponse)
return; return;
this.waitForResponse = true;
this._client.first((d: any) => d.op == 4 && d.d.request.type == 'create_group' && d.d.data.name == this.nameForm.value) this._client.first((d: any) => d.op == 4 && d.d.request.type == 'create_group' && d.d.data.name == this.nameForm.value)
.subscribe({ .subscribe({
next: (d) => this._dialogRef.close(d.d.data), next: (d) => this._dialogRef.close(d.d.data),

View File

@ -81,8 +81,11 @@ export class RedemptionItemEditComponent implements OnInit {
delete() { delete() {
const id = this.redemption.id; if (this.waitForResponse)
return;
this.waitForResponse = true this.waitForResponse = true
const id = this.redemption.id;
this.client.first((d: any) => d.op == 4 && d.d.request.type == 'delete_redemption' && d.d.request.data.id == id) this.client.first((d: any) => d.op == 4 && d.d.request.type == 'delete_redemption' && d.d.request.data.id == id)
?.subscribe({ ?.subscribe({
next: (d) => { next: (d) => {
@ -100,13 +103,15 @@ export class RedemptionItemEditComponent implements OnInit {
} }
save() { save() {
if (this.formGroups.invalid) if (this.formGroups.invalid || this.waitForResponse)
return; return;
this.waitForResponse = true;
this.responseError = undefined; this.responseError = undefined;
const order = this.orderFormControl.value; const order = this.orderFormControl.value;
if (order == null) { if (order == null) {
this.responseError = 'Order must be an integer.'; this.responseError = 'Order must be an integer.';
this.waitForResponse = false;
return; return;
} }

View File

@ -71,7 +71,7 @@ export class FilterItemEditComponent {
} }
onSaveClick(): void { onSaveClick(): void {
if (this.forms.invalid) if (this.forms.invalid || this.waitForResponse)
return; return;
this.waitForResponse = true; this.waitForResponse = true;