source: trip-planner-front/src/app/_services/planner.service.ts@ 6c1585f

Last change on this file since 6c1585f was 6c1585f, checked in by Ema <ema_spirova@…>, 3 years ago

edit planner form with angular

  • Property mode set to 100644
File size: 1.1 KB
RevLine 
[6a80231]1import { HttpClient, HttpHeaders } from "@angular/common/http";
[6a3a178]2import { Injectable } from "@angular/core";
3import { Observable } from "rxjs";
[6a80231]4import { PlannerDto } from "../_models/dto/plannerDto";
[6a3a178]5import { Planner } from "../_models/planner";
6
7@Injectable({
8 providedIn: 'root'
9})
10export class PlannerService{
11 constructor(private httpClient: HttpClient){
12 }
13 getAllPlanners():Observable<Planner[]>{
14 let url = "http://localhost:8080/api/planners";
15 return this.httpClient.get<Planner[]>(url);
16 }
[6a80231]17
[6c1585f]18 postInitialPlanner(planner: Planner, locationList: Location[]): Observable<Object>{
[6a80231]19 let url = "http://localhost:8080/api/planner/new";
[6c1585f]20 return this.httpClient.post<Planner>(url, planner);
[6a80231]21 }
22
[6c1585f]23 updatePlanner(id: number, plannerDto : PlannerDto):Observable<Planner>{
[6a80231]24 let url = "http://localhost:8080/api/edit/planner/" + id;
[6c1585f]25 return this.httpClient.put<Planner>(url, plannerDto);
26 }
27
28 getPlannerById(id:number):Observable<Planner>{
29 let url = "http://localhost:8080/api/planner/" + id;
30 return this.httpClient.get<Planner>(url);
[6a80231]31 }
[6a3a178]32}
Note: See TracBrowser for help on using the repository browser.