Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
hdastageeri
hft_awado_app
Commits
221d2907
Commit
221d2907
authored
Dec 08, 2019
by
Ratnadeep Rajendra Kharade
Browse files
displayed loading page on hire bike page for api call
parent
e4d71808
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/app/hirebike/hirebike.page.ts
View file @
221d2907
...
...
@@ -160,6 +160,7 @@ export class HirebikePage implements OnInit {
}
getReservedBike
()
{
this
.
loadingService
.
showLoader
();
this
.
storage
.
get
(
'
token
'
).
then
((
token
)
=>
{
const
headers
=
new
HttpHeaders
().
set
(
"
Authorization
"
,
"
Bearer
"
+
token
);
//call reserved bike api
...
...
@@ -181,24 +182,34 @@ export class HirebikePage implements OnInit {
//pass reserved bike subject here map
this
.
gotReservedBikeSubject
.
next
(
resp
.
data
);
},
(
reservedBikeError
)
=>
console
.
log
(
reservedBikeError
));
this
.
loadingService
.
hideLoader
();
},
(
reservedBikeError
)
=>
{
console
.
log
(
reservedBikeError
);
this
.
loadingService
.
hideLoader
();
});
}
},
(
bikeDetailsError
)
=>
console
.
log
(
bikeDetailsError
));
},
(
bikeDetailsError
)
=>
{
console
.
log
(
bikeDetailsError
);
this
.
loadingService
.
hideLoader
();
});
});
}
startTrip1
()
{
this
.
loadingService
.
showLoader
();
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
.
get
(
url
,
{
headers
});
bikeApi
.
subscribe
((
resp
)
=>
{
console
.
log
(
'
my data:
'
,
resp
);
this
.
loadingService
.
hideLoader
();
this
.
toastService
.
showToast
(
"
Trip Started
"
);
this
.
isBikeHired
=
true
;
},
(
error
)
=>
{
console
.
log
(
error
)
this
.
toastService
.
showToast
(
"
This is ongoing Trip
"
)
console
.
log
(
error
);
this
.
loadingService
.
hideLoader
();
this
.
toastService
.
showToast
(
"
This is ongoing Trip
"
);
});
});
...
...
@@ -210,15 +221,18 @@ export class HirebikePage implements OnInit {
}
CancelTrip
()
{
this
.
loadingService
.
showLoader
();
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
.
loadingService
.
hideLoader
();
this
.
toastService
.
showToast
(
"
Trip Ended!
"
);
},
(
error
)
=>
{
console
.
log
(
error
)
console
.
log
(
error
);
this
.
loadingService
.
hideLoader
();
this
.
toastService
.
showToast
(
"
No Ongong Trip to End
"
)
});
});
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment