Changeset ceaed42 for trip-planner-front/src/app/_services
- Timestamp:
- 11/11/21 12:59:26 (3 years ago)
- Branches:
- master
- Children:
- 59329aa
- Parents:
- 6c1585f
- Location:
- trip-planner-front/src/app/_services
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trip-planner-front/src/app/_services/location.service.ts
r6c1585f rceaed42 2 2 import { Injectable } from "@angular/core"; 3 3 import { Observable } from "rxjs"; 4 import { PlannerLocationDto } from "../_models/dto/plannerLocationDto"; 5 import { Location } from "../_models/location"; 4 6 5 7 @Injectable({ … … 9 11 constructor(private httpClient : HttpClient){} 10 12 11 getLocationsFromCity(cityId: number, companionId: number, lengthOfStay: number, categoryIds: string): Observable< Object[]>{13 getLocationsFromCity(cityId: number, companionId: number, lengthOfStay: number, categoryIds: string): Observable<Location[]>{ 12 14 let url = "http://localhost:8080/api/city/locations"; 13 15 return this.httpClient.get<Location[]>(url + '?cityId=' + cityId + '&companionId=' + companionId + '&lengthOfStay=' + lengthOfStay + '&categoryIds='+ categoryIds); … … 18 20 return this.httpClient.get<Location[]>(url + '?regionId=' + regionId + '&companionId=' + companionId + '&lengthOfStay=' + lengthOfStay + '&categoryIds='+ categoryIds); 19 21 } 22 23 postLocationToPlanner(plannerLocationDto : PlannerLocationDto) : Observable<Location>{ 24 let url = "http://localhost:8080/api/add-location"; 25 return this.httpClient.put<Location>(url, plannerLocationDto); 26 } 27 28 getLocationsFroPlanner(plannerId : number) : Observable<Location[]>{ 29 let url = "http://localhost:8080/api/planner/locations"; 30 return this.httpClient.get<Location[]>(url + '?plannerId=' + plannerId); 31 } 20 32 } -
trip-planner-front/src/app/_services/planner.service.ts
r6c1585f rceaed42 9 9 }) 10 10 export class PlannerService{ 11 11 12 constructor(private httpClient: HttpClient){ 12 13 } 14 13 15 getAllPlanners():Observable<Planner[]>{ 14 16 let url = "http://localhost:8080/api/planners"; … … 16 18 } 17 19 18 postInitialPlanner(planner: Planner , locationList: Location[]): Observable<Object>{20 postInitialPlanner(planner: Planner): Observable<Object>{ 19 21 let url = "http://localhost:8080/api/planner/new"; 20 22 return this.httpClient.post<Planner>(url, planner); … … 30 32 return this.httpClient.get<Planner>(url); 31 33 } 34 35 32 36 }
Note:
See TracChangeset
for help on using the changeset viewer.