Fix on the call to the API
This commit is contained in:
@@ -1,21 +1,21 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from "@angular/core";
|
||||||
import { JumpTypeResp } from '../../models/jumpType';
|
import { JumpTypeResp } from "../../models/jumpType";
|
||||||
import { AircraftResp } from '../../models/aircraft';
|
import { AircraftResp } from "../../models/aircraft";
|
||||||
import { DropZoneResp } from '../../models/dropzone';
|
import { DropZoneResp } from "../../models/dropzone";
|
||||||
import { DateService } from '../../services/date.service';
|
import { DateService } from "../../services/date.service";
|
||||||
import { GearResp } from '../../models/gear';
|
import { GearResp } from "../../models/gear";
|
||||||
import { ServiceComm } from '../../services/service-comm.service';
|
import { ServiceComm } from "../../services/service-comm.service";
|
||||||
import { DropzoneService } from '../../services/dropzone.service';
|
import { DropzoneService } from "../../services/dropzone.service";
|
||||||
import { AircraftService } from '../../services/aircraft.service';
|
import { AircraftService } from "../../services/aircraft.service";
|
||||||
import { JumpService } from '../../services/jump.service';
|
import { JumpService } from "../../services/jump.service";
|
||||||
import { JumpTypeService } from '../../services/jump-type.service';
|
import { JumpTypeService } from "../../services/jump-type.service";
|
||||||
import { GearService } from '../../services/gear.service';
|
import { GearService } from "../../services/gear.service";
|
||||||
import { isNumber } from 'util';
|
import { isNumber } from "util";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-new-jump',
|
selector: "app-new-jump",
|
||||||
templateUrl: './new-jump.component.html',
|
templateUrl: "./new-jump.component.html",
|
||||||
styleUrls: ['./new-jump.component.css'],
|
styleUrls: ["./new-jump.component.css"],
|
||||||
})
|
})
|
||||||
export class NewJumpComponent implements OnInit {
|
export class NewJumpComponent implements OnInit {
|
||||||
beginDate: Date;
|
beginDate: Date;
|
||||||
@@ -44,18 +44,13 @@ export class NewJumpComponent implements OnInit {
|
|||||||
private serviceDropzone: DropzoneService,
|
private serviceDropzone: DropzoneService,
|
||||||
private serviceGear: GearService,
|
private serviceGear: GearService,
|
||||||
private dateService: DateService
|
private dateService: DateService
|
||||||
) { }
|
) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.serviceComm.UpdatedComponentTitle('Add a new jump');
|
this.serviceComm.UpdatedComponentTitle("Add a new jump");
|
||||||
this.pendingAddRequest = false;
|
this.pendingAddRequest = false;
|
||||||
|
|
||||||
this.endDate = new Date();
|
this.initForm();
|
||||||
this.beginDate = this.dateService.AddDays(new Date(), -1);
|
|
||||||
|
|
||||||
this.exitAltitude = 4000;
|
|
||||||
this.deployAltitude = 1000;
|
|
||||||
this.countOfJumps = 1;
|
|
||||||
|
|
||||||
this.getListOfJumpTypes();
|
this.getListOfJumpTypes();
|
||||||
}
|
}
|
||||||
@@ -93,11 +88,11 @@ export class NewJumpComponent implements OnInit {
|
|||||||
this.selectedJumpType !== undefined &&
|
this.selectedJumpType !== undefined &&
|
||||||
this.selectedJumpType.id !== undefined &&
|
this.selectedJumpType.id !== undefined &&
|
||||||
this.exitAltitude !== undefined &&
|
this.exitAltitude !== undefined &&
|
||||||
typeof this.exitAltitude === 'number' &&
|
typeof this.exitAltitude === "number" &&
|
||||||
this.deployAltitude !== undefined &&
|
this.deployAltitude !== undefined &&
|
||||||
typeof this.deployAltitude === 'number' &&
|
typeof this.deployAltitude === "number" &&
|
||||||
this.countOfJumps !== undefined &&
|
this.countOfJumps !== undefined &&
|
||||||
typeof this.countOfJumps === 'number'
|
typeof this.countOfJumps === "number"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from "@angular/core";
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from "@angular/common/http";
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from "rxjs";
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from "rxjs/operators";
|
||||||
|
|
||||||
import { JumpResp, JumpReq } from '../models/jump';
|
import { JumpResp, JumpReq } from "../models/jump";
|
||||||
|
|
||||||
import { DateService } from './date.service';
|
import { DateService } from "./date.service";
|
||||||
import { BaseService } from './base.service';
|
import { BaseService } from "./base.service";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class JumpService extends BaseService {
|
export class JumpService extends BaseService {
|
||||||
@@ -94,14 +94,16 @@ export class JumpService extends BaseService {
|
|||||||
exitAltitude: defaultExitAltitude,
|
exitAltitude: defaultExitAltitude,
|
||||||
deployAltitude: defaultDeployAltitude,
|
deployAltitude: defaultDeployAltitude,
|
||||||
gearId: selectedRig,
|
gearId: selectedRig,
|
||||||
notes: '',
|
notes: "",
|
||||||
id: 0,
|
id: 0,
|
||||||
jumpDate: jumpDate,
|
jumpDate: jumpDate,
|
||||||
};
|
};
|
||||||
|
|
||||||
this.http.post(`${this.apiUrl}/Jump`, bodyNewjump, {
|
this.http
|
||||||
headers: this.headers,
|
.post(`${this.apiUrl}/Jump`, bodyNewjump, {
|
||||||
});
|
headers: this.headers,
|
||||||
|
})
|
||||||
|
.subscribe((data) => console.log(data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user