From 582edef0205e35678ba70a2f7eccbcec288689fc Mon Sep 17 00:00:00 2001 From: Katharina Will Date: Wed, 24 Apr 2019 10:10:02 +0200 Subject: [PATCH] Minor changes to CacheEnd --- frontend/src/pages/CacheEnd.vue | 13 ++++++++++--- frontend/src/router/routes.js | 5 +++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/frontend/src/pages/CacheEnd.vue b/frontend/src/pages/CacheEnd.vue index dc4e641..ff85b30 100644 --- a/frontend/src/pages/CacheEnd.vue +++ b/frontend/src/pages/CacheEnd.vue @@ -25,6 +25,9 @@ data() { return { reward: false, + cacheID: "", + cacheName: "", + rankingPoints: "", end1: "Gut gemacht, Du hast alle Stationen dieses Cache gefunden. Dir wurden ", end2: " Punkte gutgeschrieben." //TODO Punkte wirklich gutschreiben, ggf. Cache auf erledigt setzen } @@ -34,6 +37,9 @@ return localStorage.getItem('userToken'); //TODO Methode umschreiben --> funktioniert das? } }, + created() { + this.fetchData(); + }, methods: { fetchData() { this.$axios.get('/api/allCaches') @@ -43,10 +49,11 @@ console.log(this.data); console.log(response.data); const cache = response.data.find(cache => cache.id === Number(this.$route.params.cache)); - this.data.cacheName = cache.name; - this.data.cachePoints = cache.rankingPoints; + this.cacheName = cache.name; + this.rankingPoints = cache.rankingPoints; + this.cacheID = this.$route.params.cache; }) + }, } - } } diff --git a/frontend/src/router/routes.js b/frontend/src/router/routes.js index 63e5a11..158b079 100644 --- a/frontend/src/router/routes.js +++ b/frontend/src/router/routes.js @@ -55,6 +55,11 @@ const routes = [ component: () => import("layouts/MyLayout.vue"), children: [{ path: "", component: () => import("pages/CacheStart.vue") }] }, + { + path: "/CacheEnd/:cache/", + component: () => import("layouts/MyLayout.vue"), + children: [{ path: "", component: () => import("pages/CacheEnd.vue") }] + }, { path: "/profile/", component: () => import("layouts/MyLayout.vue"),