diff --git a/labswp_2019_sose_geocaching_frontend/frontend/src/pages/CacheStart.vue b/labswp_2019_sose_geocaching_frontend/frontend/src/pages/CacheStart.vue
index 951b7af..0803193 100644
--- a/labswp_2019_sose_geocaching_frontend/frontend/src/pages/CacheStart.vue
+++ b/labswp_2019_sose_geocaching_frontend/frontend/src/pages/CacheStart.vue
@@ -9,7 +9,7 @@
-
+
@@ -87,6 +87,7 @@ Vue.use(VueLayers);
this.stationID = cache.stationen[0];
this.lon = this.stationID.longitude;
this.lat = this.stationID.lattitude;
+ this.center = [this.lon, this.lat]
})
},
checkStation() {
diff --git a/labswp_2019_sose_geocaching_frontend/frontend/src/pages/StationView.vue b/labswp_2019_sose_geocaching_frontend/frontend/src/pages/StationView.vue
index 487d6bd..20c7c2c 100644
--- a/labswp_2019_sose_geocaching_frontend/frontend/src/pages/StationView.vue
+++ b/labswp_2019_sose_geocaching_frontend/frontend/src/pages/StationView.vue
@@ -4,12 +4,21 @@
data-projection="EPSG:4326" style="height: 200px" v-if="!cameraActive">
-
+
-
+
+
+
+
+
+
+
+
+
+
@@ -57,13 +66,14 @@ Vue.use(VueLayers);
stationen: [],
},
station: {},
- markercolor: "red",
+ markercolor: "grey",
cameraActive: false,
result: null,
zoom: 15,
center: [ 9.208858198755664, 49.14785422283188],
rotation: 0,
geolocPosition: undefined,
+ filteredStations: [],
}
},
beforeRouteUpdate(to, from, next) {
@@ -105,24 +115,28 @@ Vue.use(VueLayers);
},
methods: {
fetchData() {
- this.$axios.get('/api/allCaches')
- .then((response) => {
- console.log("/api/allCaches");
- console.log(response.data);
- const cache = response.data.find(cache => cache.id === Number(this.$route.params.cache));
- this.cache = cache;
- this.station = cache.stationen.find(station => station.id === Number(this.$route.params.id));
- this.cacheName = cache.name;
- this.cacheID = this.$route.params.cache;
- console.log(JSON.stringify(this.cache));
- console.log(JSON.stringify(this.station));
- console.log(this.cache);
+ if (localStorage.getItem('userToken')) {
+ let params = {cacheID: this.$route.params.cache};
+ params.token = JSON.parse(localStorage.getItem('userToken')).token;
+ this.$axios.get('/api/getCurrentStation',{params})
+ .then((response) => {
+ console.log("/api/getCurrentStation");
+ console.log(response.data);
+ const cache = response.data.cache;
+ this.cache = cache;
+ this.station = response.data.aktuelleStation;
+ this.cacheName = cache.name;
+ this.cacheID = this.$route.params.cache;
+ console.log(JSON.stringify(this.cache));
+ console.log(JSON.stringify(this.station));
+ console.log(this.cache);
+ let stationIndex = this.cache.stationen.findIndex(s => s.id === this.station.id);
+ for( let i=0; i< stationIndex; i++){
+ this.filteredStations.push(this.cache.stationen[i])
+ }
+ this.center = [this.station.longitude, this.station.lattitude]
})
- },
-
- getMarkerURL(station) {
- console.log(station);
- return `./statics/map-marker_${this.markercolor}.svg`
+ }
},
updateResult(event) {