Découpage en 1 service par composant
This commit is contained in:
@@ -1,12 +1,15 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ServiceComm } from '../../services/service-comm.service';
|
||||
import { ServiceApiGet } from '../../services/service-api-get.service';
|
||||
import { ServiceApiPost } from '../../services/service-api-post.service';
|
||||
import { JumpTypeResp } from '../../models/jumpType';
|
||||
import { AircraftResp } from '../../models/aircraft';
|
||||
import { DropZoneResp } from '../../models/dropzone';
|
||||
import { DateService } from '../../services/date.service';
|
||||
import { GearResp } from '../../models/gear';
|
||||
import { ServiceComm } from '../../services/service-comm.service';
|
||||
import { DropzoneService } from '../../services/dropzone.service';
|
||||
import { AircraftService } from '../../services/aircraft.service';
|
||||
import { JumpService } from '../../services/jump.service';
|
||||
import { JumpTypeService } from '../../services/jump-type.service';
|
||||
import { GearService } from '../../services/gear.service';
|
||||
import { isNumber } from 'util';
|
||||
|
||||
@Component({
|
||||
@@ -33,8 +36,11 @@ export class NewJumpComponent implements OnInit {
|
||||
|
||||
constructor(
|
||||
private serviceComm: ServiceComm,
|
||||
private serviceApiGet: ServiceApiGet,
|
||||
private serviceApiPost: ServiceApiPost,
|
||||
private serviceJump: JumpService,
|
||||
private serviceJumpType: JumpTypeService,
|
||||
private serviceAircraft: AircraftService,
|
||||
private serviceDropzone: DropzoneService,
|
||||
private serviceGear: GearService,
|
||||
private dateService: DateService
|
||||
) { }
|
||||
|
||||
@@ -52,7 +58,7 @@ export class NewJumpComponent implements OnInit {
|
||||
}
|
||||
|
||||
onFormSubmit() {
|
||||
this.serviceApiPost.AddListOfJump(
|
||||
this.serviceJump.AddListOfJump(
|
||||
this.selectedJumpType.id,
|
||||
this.selectedAircraft.id,
|
||||
this.selectedDz.id,
|
||||
@@ -79,7 +85,7 @@ export class NewJumpComponent implements OnInit {
|
||||
}
|
||||
|
||||
private getListOfJumpTypes() {
|
||||
this.serviceApiGet.getListOfJumpTypes().subscribe(data => {
|
||||
this.serviceJumpType.getListOfJumpTypes().subscribe(data => {
|
||||
this.listOfJumpType = data;
|
||||
this.getListOfAircrafts();
|
||||
this.getListOfDropZones();
|
||||
@@ -88,13 +94,13 @@ export class NewJumpComponent implements OnInit {
|
||||
}
|
||||
|
||||
private getListOfAircrafts() {
|
||||
this.serviceApiGet.getListOfAircrafts().subscribe(data => {
|
||||
this.serviceAircraft.getListOfAircrafts().subscribe(data => {
|
||||
this.listOfAircraft = data;
|
||||
});
|
||||
}
|
||||
|
||||
private getListOfDropZones() {
|
||||
this.serviceApiGet.getListOfDropZones().subscribe(data => {
|
||||
this.serviceDropzone.getListOfDropZones().subscribe(data => {
|
||||
data.sort((a, b) => (b.isFavorite ? 1 : 0) - (a.isFavorite ? 1 : 0));
|
||||
this.listOfDropZone = data;
|
||||
this.listOfFilteredDropZone = data;
|
||||
@@ -102,7 +108,7 @@ export class NewJumpComponent implements OnInit {
|
||||
}
|
||||
|
||||
private getListOfGears() {
|
||||
this.serviceApiGet.getListOfGears().subscribe(data => {
|
||||
this.serviceGear.getListOfGears().subscribe(data => {
|
||||
this.listOfGear = data;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user