source: trip-planner-front/src/app/_services/planner.service.ts@ 8d391a1

Last change on this file since 8d391a1 was 59329aa, checked in by Ema <ema_spirova@…>, 3 years ago

adding photos

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