fixed bug in qrscanner component

This commit is contained in:
Timo Volkmann 2019-05-10 09:49:15 +02:00
parent dc2d693562
commit d1b7fb7c87
4 changed files with 26 additions and 15 deletions

View File

@ -72,6 +72,9 @@ module.exports = function (ctx) {
'QPopupEdit', 'QPopupEdit',
'QSlideTransition', 'QSlideTransition',
'QToggle', 'QToggle',
'QStepper',
'QStep',
'QStepperNavigation'
], ],
directives: [ directives: [

View File

@ -48,6 +48,21 @@
cacheID: null, 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() { created() {
this.setCacheId(); this.setCacheId();
}, },
@ -89,6 +104,8 @@
console.log("cache access definition"); console.log("cache access definition");
console.log(response.data.cacheAccesDefinition); console.log(response.data.cacheAccesDefinition);
resolve(true); resolve(true);
this.askForPermission = true;
this.activateCamera = false;
if (Number(response.data.cacheAccesDefinition.id) === 0) { if (Number(response.data.cacheAccesDefinition.id) === 0) {
this.$router.push({path: `/station/${params.cacheID}/${params.stationID}`}); this.$router.push({path: `/station/${params.cacheID}/${params.stationID}`});
} else if (Number(response.data.cacheAccesDefinition.id) === 1) { } else if (Number(response.data.cacheAccesDefinition.id) === 1) {
@ -166,8 +183,8 @@
this.activateCamera = bool; this.activateCamera = bool;
if (this.askForPermission === false) { if (this.askForPermission === false) {
this.askForPermission = true; this.askForPermission = true;
this.updateCameraState();
} }
this.updateCameraState();
}, },
logErrors(promise) { 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()
},
} }
</script> </script>

View File

@ -37,6 +37,8 @@
}, },
beforeRouteUpdate(to, from, next) { beforeRouteUpdate(to, from, next) {
console.log("beforeRouteUpdate: reset data and fetch"); console.log("beforeRouteUpdate: reset data and fetch");
this.cameraActive = false;
this.result = null;
this.cacheID = ""; this.cacheID = "";
this.cacheName = ""; this.cacheName = "";
this.cache = { this.cache = {

View File

@ -5,7 +5,7 @@ import routes from "./routes";
import {axiosInstance} from "../boot/axios"; import {axiosInstance} from "../boot/axios";
Vue.use(VueRouter); Vue.use(VueRouter);
//import store from "../store/index"; import store from "../store/index";
/* /*
* If not building with SSR mode, you can * If not building with SSR mode, you can
@ -57,6 +57,7 @@ export default function({ store }/* { store, ssrContext } */) {
}) })
.then((response) => { .then((response) => {
console.log("Token valid!"); console.log("Token valid!");
store.commit('auth/SET_AUTHENTICATED');
return next(); return next();
}) })
.catch((error) => { .catch((error) => {
@ -72,6 +73,7 @@ export default function({ store }/* { store, ssrContext } */) {
title: "Bitte erneut anmelden.", title: "Bitte erneut anmelden.",
color: "blue", }); color: "blue", });
localStorage.removeItem('userToken'); localStorage.removeItem('userToken');
store.commit('auth/SET_AUTHENTICATED');
return next('/Login'); return next('/Login');
} else { } else {
console.log("unexpected behaviour"); console.log("unexpected behaviour");