This commit is contained in:
Sébastien André
2021-03-29 09:36:37 +02:00
parent 201a563fbc
commit b2941cf6d4
6 changed files with 25 additions and 33 deletions

View File

@@ -14,10 +14,8 @@ export class NewAircraftComponent implements OnInit {
public imageError: string;
private selectedFile: string;
constructor(
private serviceComm: ServiceComm,
private serviceApi: AircraftService
) {
constructor(private serviceComm: ServiceComm,
private serviceApi: AircraftService) {
this.addForm = new FormGroup(
{
aircraftName: new FormControl('', Validators.required)
@@ -38,9 +36,7 @@ export class NewAircraftComponent implements OnInit {
}
public onFileChanged(fileInput: any) {
const file = fileInput.dataTransfer
? fileInput.dataTransfer.files[0]
: fileInput.target.files[0];
const file = fileInput.dataTransfer ? fileInput.dataTransfer.files[0] : fileInput.target.files[0];
const allowed_types = ['image/png', 'image/jpeg'];
const max_size = 20971520;

View File

@@ -50,14 +50,13 @@ export class NewGearComponent implements OnInit {
ngOnInit() {}
onSubmit(formData) {
this.serviceApi.AddGear(
formData.name,
formData.manufacturer,
+formData.minSize,
+formData.maxSize,
formData.aad,
formData.mainCanopy,
formData.reserveCanopy
this.serviceApi.AddGear(formData.name,
formData.manufacturer,
+formData.minSize,
+formData.maxSize,
formData.aad,
formData.mainCanopy,
formData.reserveCanopy
);
this.serviceComm.RefreshData(AddAction.Gear);
}

View File

@@ -12,10 +12,8 @@ import { JumpTypeService } from "../../services/jump-type.service";
export class NewJumpTypeComponent implements OnInit {
public addForm: FormGroup;
constructor(
private serviceComm: ServiceComm,
private jumpTypeService: JumpTypeService
) {
constructor(private serviceComm: ServiceComm,
private jumpTypeService: JumpTypeService) {
this.addForm = new FormGroup(
{
jumptypeName: new FormControl("", Validators.required)

View File

@@ -24,6 +24,7 @@ export class DropzoneService extends BaseService {
public SetFavoriteDropZone(selectedDz: DropZoneResp): boolean {
selectedDz.isFavorite = true;
this.http.put(`${this.apiUrl}/DropZone/AddToFavorite/${selectedDz.id}`,
selectedDz,
{ headers: this.headers })
@@ -34,6 +35,7 @@ export class DropzoneService extends BaseService {
public RemoveFavoriteDropZone(selectedDz: DropZoneResp): boolean {
selectedDz.isFavorite = false;
this.http.put(`${this.apiUrl}/DropZone/RemoveToFavorite${selectedDz.id}`,
selectedDz,
{ headers: this.headers })

View File

@@ -18,15 +18,13 @@ export class GearService extends BaseService {
});
}
public AddGear(
name: string,
manufacturer: string,
minSize: number,
maxSize: number,
aad: string,
mainCanopy: string,
reserveCanopy: string
) {
public AddGear(name: string,
manufacturer: string,
minSize: number,
maxSize: number,
aad: string,
mainCanopy: string,
reserveCanopy: string) {
const bodyNewGear: GearReq = {
id: 0,
name: name,

View File

@@ -24,10 +24,9 @@ export class JumpTypeService extends BaseService {
name: jumptypetName
};
this.http
.post(`${this.apiUrl}/JumpType`, bodyJumpType, {
headers: this.headers
})
.subscribe(data => console.log(data));
this.http.post(`${this.apiUrl}/JumpType`,
bodyJumpType,
{ headers: this.headers })
.subscribe(data => console.log(data));
}
}