Last change
on this file since ceaed42 was ceaed42, checked in by Ema <ema_spirova@…>, 3 years ago |
add location to planner
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Rev | Line | |
---|
[6a80231] | 1 | import { HttpClient, HttpHeaders } from "@angular/common/http";
|
---|
[6a3a178] | 2 | import { Injectable } from "@angular/core";
|
---|
| 3 | import { Observable } from "rxjs";
|
---|
[6a80231] | 4 | import { PlannerDto } from "../_models/dto/plannerDto";
|
---|
[6a3a178] | 5 | import { Planner } from "../_models/planner";
|
---|
| 6 |
|
---|
| 7 | @Injectable({
|
---|
| 8 | providedIn: 'root'
|
---|
| 9 | })
|
---|
| 10 | export class PlannerService{
|
---|
[ceaed42] | 11 |
|
---|
[6a3a178] | 12 | constructor(private httpClient: HttpClient){
|
---|
| 13 | }
|
---|
[ceaed42] | 14 |
|
---|
[6a3a178] | 15 | getAllPlanners():Observable<Planner[]>{
|
---|
| 16 | let url = "http://localhost:8080/api/planners";
|
---|
| 17 | return this.httpClient.get<Planner[]>(url);
|
---|
| 18 | }
|
---|
[6a80231] | 19 |
|
---|
[ceaed42] | 20 | postInitialPlanner(planner: Planner): Observable<Object>{
|
---|
[6a80231] | 21 | let url = "http://localhost:8080/api/planner/new";
|
---|
[6c1585f] | 22 | return this.httpClient.post<Planner>(url, planner);
|
---|
[6a80231] | 23 | }
|
---|
| 24 |
|
---|
[6c1585f] | 25 | updatePlanner(id: number, plannerDto : PlannerDto):Observable<Planner>{
|
---|
[6a80231] | 26 | let url = "http://localhost:8080/api/edit/planner/" + id;
|
---|
[6c1585f] | 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);
|
---|
[6a80231] | 33 | }
|
---|
[ceaed42] | 34 |
|
---|
| 35 |
|
---|
[6a3a178] | 36 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.