Files
SkydiveLogs/Front/skydivelogs-app/src/services/tunnel-flight.service.ts
Sébastien ANDRE 146bbe89c3 Fix
2023-06-15 10:02:14 +02:00

34 lines
887 B
TypeScript

import { Injectable } from "@angular/core";
import { DatePipe } from "@angular/common";
import { HttpClient } from "@angular/common/http";
import { TunnelFlightReq } from "../models/tunnel-flight";
import { BaseService } from "./base.service";
@Injectable()
export class TunnelFlightService extends BaseService {
private datePipe: DatePipe;
constructor(private http: HttpClient) {
super();
}
public addFlight(selectedTunnel: number,
flightDate: Date,
nbMinutes: number,
comment: string)
{
const bodyNewFlight: TunnelFlightReq = {
id: 0,
tunnelId: selectedTunnel,
flightDate: this.datePipe.transform(flightDate, "yyyy-MM-dd"),
notes: comment,
nbMinutes: nbMinutes
};
return this.http.post(`${this.apiUrl}/TunnelFlight`, bodyNewFlight, { headers: this.headers});
}
}