From 09639a4a563792f72334bc6d2b6bbbed5e82ca60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Andr=C3=A9?= Date: Mon, 29 Mar 2021 16:25:35 +0200 Subject: [PATCH] Subscribe au bon endroit pour un refresh correct de la liste des infos. --- .../new-aircraft/new-aircraft.component.ts | 6 +++-- .../new-drop-zone/new-drop-zone.component.ts | 22 +++++++++---------- .../src/app/new-gear/new-gear.component.ts | 9 ++++---- .../new-jump-type/new-jump-type.component.ts | 10 +++++---- .../src/services/aircraft.service.ts | 7 +++--- .../src/services/dropzone.service.ts | 11 +++++----- .../src/services/gear.service.ts | 3 +-- .../src/services/jump-type.service.ts | 7 +++--- 8 files changed, 38 insertions(+), 37 deletions(-) diff --git a/Front/skydivelogs-app/src/app/new-aircraft/new-aircraft.component.ts b/Front/skydivelogs-app/src/app/new-aircraft/new-aircraft.component.ts index 18358f5..050cbbe 100644 --- a/Front/skydivelogs-app/src/app/new-aircraft/new-aircraft.component.ts +++ b/Front/skydivelogs-app/src/app/new-aircraft/new-aircraft.component.ts @@ -31,8 +31,10 @@ export class NewAircraftComponent implements OnInit { return; } - this.serviceApi.AddAircraft(formData.aircraftName, this.selectedFile); - this.serviceComm.RefreshData(AddAction.Aircraft); + this.serviceApi.AddAircraft(formData.aircraftName, this.selectedFile) + .subscribe(() => { + this.serviceComm.RefreshData(AddAction.Aircraft); + }); } public onFileChanged(fileInput: any) { diff --git a/Front/skydivelogs-app/src/app/new-drop-zone/new-drop-zone.component.ts b/Front/skydivelogs-app/src/app/new-drop-zone/new-drop-zone.component.ts index af69808..722830e 100644 --- a/Front/skydivelogs-app/src/app/new-drop-zone/new-drop-zone.component.ts +++ b/Front/skydivelogs-app/src/app/new-drop-zone/new-drop-zone.component.ts @@ -49,16 +49,16 @@ export class NewDropZoneComponent implements OnInit { dzType.push("tunnel"); } - this.dropzoneService.AddDropZone( - splitGps[0], - splitGps[1], - formData.dzName, - formData.address, - formData.website, - formData.contactMail, - dzType, - false - ); - this.serviceComm.RefreshData(AddAction.Dropzone); + this.dropzoneService.AddDropZone(splitGps[0], + splitGps[1], + formData.dzName, + formData.address, + formData.website, + formData.contactMail, + dzType, + false) + .subscribe(() => { + this.serviceComm.RefreshData(AddAction.Dropzone); + }); } } diff --git a/Front/skydivelogs-app/src/app/new-gear/new-gear.component.ts b/Front/skydivelogs-app/src/app/new-gear/new-gear.component.ts index c054b7c..6ccbe1e 100644 --- a/Front/skydivelogs-app/src/app/new-gear/new-gear.component.ts +++ b/Front/skydivelogs-app/src/app/new-gear/new-gear.component.ts @@ -47,7 +47,7 @@ export class NewGearComponent implements OnInit { ); } - ngOnInit() {} + ngOnInit() { } onSubmit(formData) { this.serviceApi.AddGear(formData.name, @@ -56,8 +56,9 @@ export class NewGearComponent implements OnInit { +formData.maxSize, formData.aad, formData.mainCanopy, - formData.reserveCanopy - ); - this.serviceComm.RefreshData(AddAction.Gear); + formData.reserveCanopy) + .subscribe(() => { + this.serviceComm.RefreshData(AddAction.Gear); + }); } } diff --git a/Front/skydivelogs-app/src/app/new-jump-type/new-jump-type.component.ts b/Front/skydivelogs-app/src/app/new-jump-type/new-jump-type.component.ts index 75127f6..269adab 100644 --- a/Front/skydivelogs-app/src/app/new-jump-type/new-jump-type.component.ts +++ b/Front/skydivelogs-app/src/app/new-jump-type/new-jump-type.component.ts @@ -13,7 +13,7 @@ export class NewJumpTypeComponent implements OnInit { public addForm: FormGroup; constructor(private serviceComm: ServiceComm, - private jumpTypeService: JumpTypeService) { + private jumpTypeService: JumpTypeService) { this.addForm = new FormGroup( { jumptypeName: new FormControl("", Validators.required) @@ -22,10 +22,12 @@ export class NewJumpTypeComponent implements OnInit { ); } - ngOnInit() {} + ngOnInit() { } onSubmit(formData) { - this.jumpTypeService.AddJumpType(formData.jumptypeName); - this.serviceComm.RefreshData(AddAction.JumpType); + this.jumpTypeService.AddJumpType(formData.jumptypeName) + .subscribe(() => { + this.serviceComm.RefreshData(AddAction.JumpType); + }); } } diff --git a/Front/skydivelogs-app/src/services/aircraft.service.ts b/Front/skydivelogs-app/src/services/aircraft.service.ts index 7cbe43c..40626c4 100644 --- a/Front/skydivelogs-app/src/services/aircraft.service.ts +++ b/Front/skydivelogs-app/src/services/aircraft.service.ts @@ -25,9 +25,8 @@ export class AircraftService extends BaseService { imageData: dataImg }; - this.http.post(`${this.apiUrl}/Aircraft`, - bodyNewAircraft, - { headers: this.headers }) - .subscribe(data => console.log(data)); + return this.http.post(`${this.apiUrl}/Aircraft`, + bodyNewAircraft, + { headers: this.headers }); } } diff --git a/Front/skydivelogs-app/src/services/dropzone.service.ts b/Front/skydivelogs-app/src/services/dropzone.service.ts index 90abc0d..21c47a0 100644 --- a/Front/skydivelogs-app/src/services/dropzone.service.ts +++ b/Front/skydivelogs-app/src/services/dropzone.service.ts @@ -28,7 +28,7 @@ export class DropzoneService extends BaseService { this.http.put(`${this.apiUrl}/DropZone/AddToFavorite/${selectedDz.id}`, selectedDz, { headers: this.headers }) - .subscribe(data => console.log(data)); + .subscribe(); return true; } @@ -39,7 +39,7 @@ export class DropzoneService extends BaseService { this.http.put(`${this.apiUrl}/DropZone/RemoveToFavorite${selectedDz.id}`, selectedDz, { headers: this.headers }) - .subscribe(data => console.log(data)); + .subscribe(); return true; } @@ -64,9 +64,8 @@ export class DropzoneService extends BaseService { isFavorite: isFavorite }; - this.http.post(`${this.apiUrl}/DropZone`, - bodyNewDropZone, - { headers: this.headers }) - .subscribe(data => console.log(data)); + return this.http.post(`${this.apiUrl}/DropZone`, + bodyNewDropZone, + { headers: this.headers }); } } diff --git a/Front/skydivelogs-app/src/services/gear.service.ts b/Front/skydivelogs-app/src/services/gear.service.ts index 9811ced..c78848b 100644 --- a/Front/skydivelogs-app/src/services/gear.service.ts +++ b/Front/skydivelogs-app/src/services/gear.service.ts @@ -36,7 +36,6 @@ export class GearService extends BaseService { reserveCanopy: reserveCanopy }; - this.http.post(`${this.apiUrl}/Gear`, bodyNewGear, { headers: this.headers}) - .subscribe(data => console.log(data)); + return this.http.post(`${this.apiUrl}/Gear`, bodyNewGear, { headers: this.headers}); } } diff --git a/Front/skydivelogs-app/src/services/jump-type.service.ts b/Front/skydivelogs-app/src/services/jump-type.service.ts index 0e25fb0..3722b04 100644 --- a/Front/skydivelogs-app/src/services/jump-type.service.ts +++ b/Front/skydivelogs-app/src/services/jump-type.service.ts @@ -24,9 +24,8 @@ export class JumpTypeService extends BaseService { name: jumptypetName }; - this.http.post(`${this.apiUrl}/JumpType`, - bodyJumpType, - { headers: this.headers }) - .subscribe(data => console.log(data)); + return this.http.post(`${this.apiUrl}/JumpType`, + bodyJumpType, + { headers: this.headers }); } }