From df0f482f0d93e99d29d696b9138fe2fa3dc148bf Mon Sep 17 00:00:00 2001 From: Priyanka Upadhye <92uppr1mst@hft-stuttgart.de> Date: Thu, 28 Nov 2019 15:06:05 +0100 Subject: [PATCH] Added bike reservation api call. --- src/app/home/home.page.ts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index 16fd7c2..35ef028 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -24,7 +24,7 @@ export class HomePage { public is3DChecked = false; public isDetailsVisible = false; - public selectedBike ={}; + public selectedBike ={id: 0}; public tempArr = [1, 2]; public locationArr = [{ lat: 48.778409, lng: 9.179252 }, @@ -229,7 +229,23 @@ export class HomePage { showBikeDetails(bike) { this.selectedBike=bike; + this.selectedBike.id=bike.id; this.isDetailsVisible = true; } + reserveBike() + { + //this.selectedBike=bikeS; + this.storage.get('token').then((token) => { + let url = 'http://193.196.52.237:8081/reservation' + '?bikeId=' + this.selectedBike.id; + const headers = new HttpHeaders().set("Authorization", "Bearer " + token); + this.bikeApi = this.httpClient.get(url, { headers }); + this.bikeApi.subscribe((resp) => { + console.log('my data: ', resp); + this.bikes = resp; + }, (error) => console.log(error)); + }); + + + } } -- GitLab