import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';

@Injectable({
  providedIn: 'root'
})
export class FlightService {

  private url: string = "http://localhost:9077/AVB/service/airport";
  private urlLeg: string = "http://localhost:9077/AVB/service/leg/";

  constructor(private httpClient: HttpClient) { }

  getAirports(): Observable<any[]> {
    return this.httpClient.get<any[]>(`${this.url}/all`);
  }

  addLeg(query: any): Observable<Object> {
    return this.httpClient.post(this.urlLeg, query);
  }
}
