From fca55827e8eefef753e31b9a52a508dfebf07da7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Andr=C3=A9?= Date: Tue, 25 Aug 2020 17:10:35 +0200 Subject: [PATCH] fix --- .../src/app/new-jump/new-jump.component.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Front/skydivelogs-app/src/app/new-jump/new-jump.component.ts b/Front/skydivelogs-app/src/app/new-jump/new-jump.component.ts index e13b81f..e969d41 100644 --- a/Front/skydivelogs-app/src/app/new-jump/new-jump.component.ts +++ b/Front/skydivelogs-app/src/app/new-jump/new-jump.component.ts @@ -34,6 +34,7 @@ export class NewJumpComponent implements OnInit { listOfFilteredDropZone: Array; listOfGear: Array; private countDatasLoaded: number; + private pendingAddRequest: boolean; constructor( private serviceComm: ServiceComm, @@ -47,6 +48,7 @@ export class NewJumpComponent implements OnInit { ngOnInit() { this.serviceComm.UpdatedComponentTitle("Add a new jump"); + this.pendingAddRequest = false; this.endDate = new Date(); this.beginDate = this.dateService.AddDays(new Date(), -1); @@ -59,6 +61,8 @@ export class NewJumpComponent implements OnInit { } onFormSubmit() { + this.pendingAddRequest = true; + this.serviceJump.AddListOfJump( this.selectedJumpType.id, this.selectedAircraft.id, @@ -72,7 +76,10 @@ export class NewJumpComponent implements OnInit { this.countOfJumps ); - this.initForm(); + setTimeout(() => { + this.initForm(); + this.pendingAddRequest = false; + }, 1000); } public isValidatedForm(): boolean { @@ -140,6 +147,8 @@ export class NewJumpComponent implements OnInit { this.selectedGear = undefined; this.selectedAircraft = undefined; this.selectedJumpType = undefined; + + this.listOfFilteredDropZone = this.listOfDropZone; } public displayFn(data?: JumpTypeResp): string | undefined { @@ -160,7 +169,7 @@ export class NewJumpComponent implements OnInit { ); } - public allDatasLoaded(): boolean { - return this.countDatasLoaded === 4; + public loadingToDisplay(): boolean { + return this.pendingAddRequest || this.countDatasLoaded === 4; } }