From e67ace8934e8a41bc9eef5b0bb0e1d329edefe48 Mon Sep 17 00:00:00 2001 From: Jonathan Bouzekri Date: Tue, 27 Jun 2017 22:44:27 +0200 Subject: [PATCH] quick form to search by lat, lng --- src/components/GmaltMap.vue | 37 +++++++++++++++++++++++++++---------- src/services/AltService.js | 3 --- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/src/components/GmaltMap.vue b/src/components/GmaltMap.vue index 12a87ce..9c9c615 100644 --- a/src/components/GmaltMap.vue +++ b/src/components/GmaltMap.vue @@ -1,13 +1,13 @@ @@ -58,9 +69,11 @@ this.fetchAltitude() }, fetchAltitude () { - this.loading = true const requestedPosition = this.position - AltService + this.loading = true + this.showMarker = true + this.center = this.position + return AltService .get(this.position) .then((json) => { if (requestedPosition === this.position) { @@ -68,12 +81,16 @@ this.alt = json.alt } }) + .catch((err) => { + console.log(err) + }) } }, data () { return { showMarker: false, - position: defaultPos, + position: { lat: null, lng: null }, + center: defaultPos, alt: null, loading: false } diff --git a/src/services/AltService.js b/src/services/AltService.js index f31a811..5cd73fb 100644 --- a/src/services/AltService.js +++ b/src/services/AltService.js @@ -17,8 +17,5 @@ export default { .then(function (response) { return response.json() }) - .catch(function (ex) { - console.log('parsing failed', ex) - }) } }