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