diff --git a/src/components/LocationError.vue b/src/components/LocationError.vue index 2be7835..6e47d4d 100644 --- a/src/components/LocationError.vue +++ b/src/components/LocationError.vue @@ -26,7 +26,11 @@ export default { this.$store.dispatch( 'setCurrentPosition', { - coords: { latitude: value.latlng.lat, longitude: value.latlng.lng }, + coords: { + latitude: value.latlng.lat, + longitude: value.latlng.lng, + speed: null, + }, timestamp: new Date().getTime(), }, ); diff --git a/src/views/Map.vue b/src/views/Map.vue index 0fd786f..058bde5 100644 --- a/src/views/Map.vue +++ b/src/views/Map.vue @@ -98,10 +98,14 @@ export default { return this.$store.getters.getLastLocation || {}; }, currentSpeed() { - if (this.hasCenterProvidedByRoute || !this.currentLocation) { + if ( + this.hasCenterProvidedByRoute + || !this.currentLocation + || !this.currentLocation.speed + ) { return null; } - return Math.round(this.currentLocation.speed || 0, 0); + return Math.round(this.currentLocation.speed, 0); }, error() { const errorCode = this.$store.state.location.error;