Fixed waiting for responses in code for certain actions.
This commit is contained in:
parent
d0556dce9c
commit
2f2215b041
@ -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),
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user