- Timestamp:
- 12/28/21 08:56:55 (3 years ago)
- Branches:
- master
- Children:
- b738035
- Parents:
- 84d0fbb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trip-planner-front/src/app/_services/planner.service.ts
r84d0fbb rbdd6491 11 11 12 12 httpHeaders: HttpHeaders = new HttpHeaders({ 13 'Authorization': '' +sessionStorage.getItem("token"),13 'Authorization': '' + sessionStorage.getItem("token"), 14 14 'Accept': 'application/json', 15 15 'Content-Type': 'application/json' 16 }); 17 16 }); 18 17 19 constructor(private httpClient: HttpClient){ 18 19 constructor(private httpClient: HttpClient) { 20 20 } 21 21 22 23 getAllPlanners(): Observable<Planner[]>{22 23 getAllPlanners(): Observable<Planner[]> { 24 24 let url = "http://localhost:8080/api/planners/user"; 25 25 console.log("SERVID: " + sessionStorage.getItem("token")); 26 console.log(this.httpHeaders.get('Authorization')) 27 return this.httpClient.get<Planner[]>(url, { headers: this.httpHeaders});26 console.log(this.httpHeaders.get('Authorization')); 27 return this.httpClient.get<Planner[]>(url, { headers: this.httpHeaders }); 28 28 } 29 29 30 postInitialPlanner(planner : Planner): Observable<Planner>{30 postInitialPlanner(plannerDto: PlannerDto): Observable<Planner> { 31 31 let url = "http://localhost:8080/api/planner/new"; 32 return this.httpClient.post<Planner>(url, planner );32 return this.httpClient.post<Planner>(url, plannerDto); 33 33 } 34 34 35 updatePlanner(id: number, plannerDto : PlannerDto):Observable<Planner>{36 let url = "http://localhost:8080/api/edit/planner/" + id;37 return this.httpClient.put<Planner>(url, plannerDto, {headers: this.httpHeaders});35 updatePlanner(id: number, plannerDto: PlannerDto): Observable<Planner> { 36 let url = "http://localhost:8080/api/edit/planner/" + id; 37 return this.httpClient.put<Planner>(url, plannerDto, { headers: this.httpHeaders }); 38 38 } 39 39 40 getPlannerById(id: number):Observable<Planner>{40 getPlannerById(id: number): Observable<Planner> { 41 41 let url = "http://localhost:8080/api/planner/" + id; 42 42 return this.httpClient.get<Planner>(url); 43 43 } 44 44 45 45 deletePlannerById(id: number): Observable<Planner> { 46 let url = "http://localhost:8080/api/delete/" + id; 47 return this.httpClient.delete<Planner>(url, { headers: this.httpHeaders }); 48 } 46 49 }
Note:
See TracChangeset
for help on using the changeset viewer.