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

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

create initial planner and routing with angular

  • Property mode set to 100644
File size: 907 bytes
Line 
1import { HttpClient, HttpHeaders } 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 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 }
17
18 postInitialPlanner(plannerDto: PlannerDto): Observable<Object>{
19 let url = "http://localhost:8080/api/planner/new";
20 return this.httpClient.post<Planner>(url, plannerDto);
21 }
22
23 updatePlanner(id: number):Observable<Planner>{
24 let url = "http://localhost:8080/api/edit/planner/" + id;
25 return this.httpClient.put<Planner>(url, null);
26 }
27}
Note: See TracBrowser for help on using the repository browser.