diff --git a/frontend/quasar.conf.js b/frontend/quasar.conf.js index f1a98b0..c0f8b50 100644 --- a/frontend/quasar.conf.js +++ b/frontend/quasar.conf.js @@ -72,6 +72,9 @@ module.exports = function (ctx) { 'QPopupEdit', 'QSlideTransition', 'QToggle', + 'QStepper', + 'QStep', + 'QStepperNavigation' ], directives: [ diff --git a/frontend/src/components/qrscanner.vue b/frontend/src/components/qrscanner.vue index a2abe74..471a353 100644 --- a/frontend/src/components/qrscanner.vue +++ b/frontend/src/components/qrscanner.vue @@ -48,6 +48,21 @@ cacheID: null, } }, + beforeRouteUpdate(to, from, next) { + console.log("beforeRouteUpdate"); + 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.setCacheId(); + this.updateCameraState(); + next() + }, created() { this.setCacheId(); }, @@ -89,6 +104,8 @@ console.log("cache access definition"); console.log(response.data.cacheAccesDefinition); resolve(true); + this.askForPermission = true; + this.activateCamera = false; if (Number(response.data.cacheAccesDefinition.id) === 0) { this.$router.push({path: `/station/${params.cacheID}/${params.stationID}`}); } else if (Number(response.data.cacheAccesDefinition.id) === 1) { @@ -166,8 +183,8 @@ this.activateCamera = bool; if (this.askForPermission === false) { this.askForPermission = true; - this.updateCameraState(); } + this.updateCameraState(); }, logErrors(promise) { @@ -190,19 +207,6 @@ } } }, - beforeRouteUpdate(to, from, next) { - 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.setCacheId(); - next() - }, } diff --git a/frontend/src/pages/StationView.vue b/frontend/src/pages/StationView.vue index 990e5b1..5e32c7c 100644 --- a/frontend/src/pages/StationView.vue +++ b/frontend/src/pages/StationView.vue @@ -37,6 +37,8 @@ }, beforeRouteUpdate(to, from, next) { console.log("beforeRouteUpdate: reset data and fetch"); + this.cameraActive = false; + this.result = null; this.cacheID = ""; this.cacheName = ""; this.cache = { diff --git a/frontend/src/router/index.js b/frontend/src/router/index.js index 713eb99..e56463b 100644 --- a/frontend/src/router/index.js +++ b/frontend/src/router/index.js @@ -5,7 +5,7 @@ import routes from "./routes"; import {axiosInstance} from "../boot/axios"; Vue.use(VueRouter); -//import store from "../store/index"; +import store from "../store/index"; /* * If not building with SSR mode, you can @@ -57,6 +57,7 @@ export default function({ store }/* { store, ssrContext } */) { }) .then((response) => { console.log("Token valid!"); + store.commit('auth/SET_AUTHENTICATED'); return next(); }) .catch((error) => { @@ -72,6 +73,7 @@ export default function({ store }/* { store, ssrContext } */) { title: "Bitte erneut anmelden.", color: "blue", }); localStorage.removeItem('userToken'); + store.commit('auth/SET_AUTHENTICATED'); return next('/Login'); } else { console.log("unexpected behaviour");