cacheview now properly loads new data

This commit is contained in:
Timo Volkmann 2019-05-01 21:23:59 +02:00
parent 57c62d421d
commit 1f2ee957e8
2 changed files with 27 additions and 5 deletions

View File

@ -67,8 +67,6 @@
this.$axios.get('/api/allCaches') this.$axios.get('/api/allCaches')
.then((response) => { .then((response) => {
console.log("/api/allCaches"); console.log("/api/allCaches");
console.log(JSON.stringify(this.data));
console.log(this.data);
console.log(response.data); console.log(response.data);
const cache = response.data.find(cache => cache.id === Number(this.$route.params.cache)); const cache = response.data.find(cache => cache.id === Number(this.$route.params.cache));
this.cacheName = cache.name; this.cacheName = cache.name;

View File

@ -74,16 +74,40 @@
} }
}, },
beforeRouteUpdate (to, from, next) {
console.log("beforeRouteUpdate: reset data and fetch");
this.cacheID = "";
this.cacheName = "";
this.cache = {
name: "",
stationen: [],
};
this.station = {};
this.askForPermission = true;
this.activateCamera = false;
this.isValid = false;
this.validating = false;
this.loading = false;
this.paused = false;
this.result = null;
this.params = null;
this.noStreamApiSupport = false;
this.fetchData();
next()
},
created: function () { created: function () {
console.log("StationView: "); console.log("StationView: created!");
// console.log("'id' from url: " + this.$route.params.id) console.log("'id' from url: " + this.$route.params.id);
// console.log("'cache' from url: " + this.$route.params.cache) console.log("'cache' from url: " + this.$route.params.cache);
this.fetchData(); this.fetchData();
}, },
beforeMount: function () { beforeMount: function () {
}, },
mounted: function () { mounted: function () {
}, },
updated: function () {
},
computed: { computed: {
showCacheProgress() { showCacheProgress() {
if (this.cache !== null) { if (this.cache !== null) {