Correction sur la mise en cache des data ref et
la vérification "AlwaysLogin"
This commit is contained in:
@@ -1,5 +1,12 @@
|
||||
import { Component, OnInit } from "@angular/core";
|
||||
import { TranslateService } from "@ngx-translate/core";
|
||||
import { Observable, forkJoin } from "rxjs";
|
||||
|
||||
import { AircraftService } from "../../services/aircraft.service";
|
||||
import { AuthenticationService } from "../../services/authentication.service";
|
||||
import { DropzoneService } from "../../services/dropzone.service";
|
||||
import { GearService } from "../../services/gear.service";
|
||||
import { JumpTypeService } from "../../services/jump-type.service";
|
||||
import { ServiceComm } from "../../services/service-comm.service";
|
||||
|
||||
@Component({
|
||||
@@ -9,11 +16,29 @@ import { ServiceComm } from "../../services/service-comm.service";
|
||||
})
|
||||
export class DefaultComponent implements OnInit {
|
||||
constructor(private serviceComm: ServiceComm,
|
||||
private translateService: TranslateService) {}
|
||||
private translateService: TranslateService,
|
||||
private authenticationService: AuthenticationService,
|
||||
private serviceApiAircraft : AircraftService,
|
||||
private serviceApiJumpType : JumpTypeService,
|
||||
private serviceApiDropzone : DropzoneService,
|
||||
private serviceApiGear : GearService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.authenticationService.alwaysLogin();
|
||||
|
||||
this.putToCacheRefDatas().subscribe(() => { console.log("Push to cache the referentiel datas"); });
|
||||
|
||||
this.translateService.get("Home").subscribe(
|
||||
data => { this.serviceComm.UpdatedComponentTitle(data); }
|
||||
);
|
||||
}
|
||||
|
||||
private putToCacheRefDatas(): Observable<any[]> {
|
||||
var aircraftResp = this.serviceApiAircraft.getListOfAircrafts(false);
|
||||
var jumpTypeResp = this.serviceApiJumpType.getListOfJumpTypes();
|
||||
var dzResp = this.serviceApiDropzone.getListOfDropZones(false);
|
||||
var gearResp = this.serviceApiGear.getListOfGears();
|
||||
|
||||
return forkJoin([aircraftResp, jumpTypeResp, dzResp, gearResp]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user