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',
'QSlideTransition',
'QToggle',
'QStepper',
'QStep',
'QStepperNavigation'
],
directives: [

View File

@ -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()
},
}
</script>

View File

@ -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 = {

View File

@ -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");