From e758ba22bc2fd9ebb9dca20ad48c9438dfede2e4 Mon Sep 17 00:00:00 2001 From: Priyanka Upadhye <92uppr1mst@hft-stuttgart.de> Date: Fri, 29 Nov 2019 15:40:50 +0100 Subject: [PATCH 1/2] end trip api called --- src/app/hirebike/hirebike.page.html | 6 +----- src/app/hirebike/hirebike.page.ts | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/app/hirebike/hirebike.page.html b/src/app/hirebike/hirebike.page.html index c3923a0..cefa3a9 100644 --- a/src/app/hirebike/hirebike.page.html +++ b/src/app/hirebike/hirebike.page.html @@ -46,14 +46,10 @@
- - Any Problems? - - - Cancel Trip + End Trip diff --git a/src/app/hirebike/hirebike.page.ts b/src/app/hirebike/hirebike.page.ts index b17b5c1..3de406a 100644 --- a/src/app/hirebike/hirebike.page.ts +++ b/src/app/hirebike/hirebike.page.ts @@ -110,7 +110,23 @@ export class HirebikePage implements OnInit { } - + CancelTrip(){ + + this.storage.get('token').then((token) => { + let url = 'http://193.196.52.237:8081/rent' + '?bikeId=' + this.bikeDetails.id; + const headers = new HttpHeaders().set("Authorization", "Bearer " + token); + let bikeApi = this.httpClient.delete(url, { headers }); + bikeApi.subscribe((resp) => { + console.log('my data: ', resp); + this.toastService.showToast("Trip Ended!"); + }, (error) => { + console.log(error) + this.toastService.showToast("Unavle to end trip") + }); + }); + + } + loadmap() { var defaultLayers = this.platform.createDefaultLayers(); -- GitLab From d4429a26fc3ecc94e571b39ce92689cbaf910c83 Mon Sep 17 00:00:00 2001 From: Priyanka Upadhye <92uppr1mst@hft-stuttgart.de> Date: Fri, 29 Nov 2019 16:02:36 +0100 Subject: [PATCH 2/2] Ent trip API integrated --- src/app/hirebike/hirebike.page.html | 17 +++++------------ src/app/hirebike/hirebike.page.ts | 3 ++- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/app/hirebike/hirebike.page.html b/src/app/hirebike/hirebike.page.html index cefa3a9..972dc2f 100644 --- a/src/app/hirebike/hirebike.page.html +++ b/src/app/hirebike/hirebike.page.html @@ -21,7 +21,7 @@
-
+
@@ -33,21 +33,13 @@ Bike Location {{bikeDetails.address}} - + Start Trip - -
-
-
-
-
-
- - - + + End Trip @@ -56,4 +48,5 @@
+ \ No newline at end of file diff --git a/src/app/hirebike/hirebike.page.ts b/src/app/hirebike/hirebike.page.ts index 3de406a..f92752c 100644 --- a/src/app/hirebike/hirebike.page.ts +++ b/src/app/hirebike/hirebike.page.ts @@ -102,6 +102,7 @@ export class HirebikePage implements OnInit { bikeApi.subscribe((resp) => { console.log('my data: ', resp); this.toastService.showToast("Trip Started"); + this.isBikeHired=true; }, (error) => { console.log(error) this.toastService.showToast("This is ongoing Trip") @@ -121,7 +122,7 @@ export class HirebikePage implements OnInit { this.toastService.showToast("Trip Ended!"); }, (error) => { console.log(error) - this.toastService.showToast("Unavle to end trip") + this.toastService.showToast("No Ongong Trip to End") }); }); -- GitLab