- Timestamp:
- 02/06/22 18:15:51 (3 years ago)
- Branches:
- master
- Children:
- 571e0df
- Parents:
- 76712b2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trip-planner-front/src/app/_services/location.service.ts
r76712b2 r6fe77af 1 import { HttpClient } from "@angular/common/http";1 import { HttpClient, HttpHeaders } from "@angular/common/http"; 2 2 import { Injectable } from "@angular/core"; 3 3 import { Observable } from "rxjs"; 4 import { LocationDto } from "../_models/dto/locationDto"; 4 5 import { PlannerLocationDto } from "../_models/dto/plannerLocationDto"; 5 6 import { Location } from "../_models/location"; … … 9 10 }) 10 11 export class LocationService{ 12 13 httpHeaders: HttpHeaders = new HttpHeaders({ 14 'Authorization': '' + sessionStorage.getItem("token"), 15 'Accept': 'application/json', 16 'Content-Type': 'application/json' 17 }); 18 11 19 constructor(private httpClient : HttpClient){} 12 20 … … 65 73 return this.httpClient.get<Location[]>(url + "?place=" + place); 66 74 } 75 76 save(locationDto : LocationDto) : Observable<Location>{ 77 let url = "http://localhost:8080/api/add"; 78 return this.httpClient.post<Location>(url, locationDto, {headers: this.httpHeaders}); 79 } 67 80 }
Note:
See TracChangeset
for help on using the changeset viewer.