fixed cache process
This commit is contained in:
parent
65d3e77558
commit
33ed2e32b9
@ -2,7 +2,7 @@ import axios from "axios";
|
||||
|
||||
const axiosInstance = axios.create({
|
||||
baseURL: process.env.API,
|
||||
timeout: 3000
|
||||
timeout: 6000
|
||||
});
|
||||
console.log("process.env.DEV: "+process.env.DEV);
|
||||
console.log("process.env.API: "+process.env.API);
|
||||
|
||||
@ -126,8 +126,14 @@
|
||||
this.$axios.get('/api/checkStation', {params})
|
||||
.then((response) => {
|
||||
console.log("resolve(true)");
|
||||
console.log("cache access definition");
|
||||
console.log(response.data.cacheAccesDefinition);
|
||||
resolve(true);
|
||||
this.$router.push({path: `/station/${params.cacheID}/${params.stationID}`});
|
||||
if (Number(response.data.cacheAccesDefinition.id) === 0) {
|
||||
this.$router.push({path: `/station/${params.cacheID}/${params.stationID}`});
|
||||
} else if (Number(response.data.cacheAccesDefinition.id) === 1) {
|
||||
this.$router.push({path: `/CacheEnd/${params.cacheID}`});
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.log("resolve(false)");
|
||||
// Error
|
||||
|
||||
@ -52,6 +52,8 @@
|
||||
data() {
|
||||
return {
|
||||
//code: "",
|
||||
cacheID: "",
|
||||
cacheName: "",
|
||||
cache: null,
|
||||
data: {
|
||||
cacheId: 22,
|
||||
@ -91,9 +93,13 @@
|
||||
},
|
||||
computed: {
|
||||
showCacheProgress() {
|
||||
let stationCount = this.cache.stationen.length;
|
||||
let stationPos = 1 + this.cache.stationen.findIndex(station => station.id === Number(this.$route.params.id));
|
||||
return `${stationPos} von ${stationCount}`;
|
||||
if (this.cache !== null) {
|
||||
let stationCount = this.cache.stationen.length;
|
||||
let stationPos = 1 + this.cache.stationen.findIndex(station => station.id === Number(this.$route.params.id));
|
||||
return `${stationPos} von ${stationCount}`;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@ -105,61 +111,10 @@
|
||||
console.log(this.data);
|
||||
console.log(response.data);
|
||||
const cache = response.data.find(cache => cache.id === Number(this.$route.params.cache));
|
||||
this.data.cacheId = cache.id;
|
||||
this.data.cacheName = cache.name;
|
||||
this.cache = cache;
|
||||
console.log(JSON.stringify(this.data));
|
||||
this.$axios.get('/api/getAllStations')
|
||||
.then((response) => {
|
||||
console.log("/api/getAllStations");
|
||||
console.log(response.data);
|
||||
const stationView = response.data.find(station => station.id === Number(this.$route.params.id));
|
||||
console.log(JSON.stringify(stationView));
|
||||
this.data.station = stationView;
|
||||
}).catch((error) => {
|
||||
// Error
|
||||
let msg;
|
||||
let title;
|
||||
if (error.response) {
|
||||
// The request was made and the server responded with a status code
|
||||
title = "Problem with response!";
|
||||
msg = error.response;
|
||||
} else if (error.request) {
|
||||
// The request was made but no response was received
|
||||
title = "Problem with request!";
|
||||
msg = "Error occured due to wrong server request!"
|
||||
console.log(error.request);
|
||||
} else {
|
||||
// Something happened in setting up the request that triggered an Error
|
||||
title = "Error";
|
||||
msg = error.message;
|
||||
console.log('Error', error.message);
|
||||
}
|
||||
console.log(error.config);
|
||||
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', { message: msg, title: title, });
|
||||
})
|
||||
}).catch((error) => {
|
||||
// Error
|
||||
let msg;
|
||||
let title;
|
||||
if (error.response) {
|
||||
// The request was made and the server responded with a status code
|
||||
title = "Problem with response!";
|
||||
msg = error.response;
|
||||
} else if (error.request) {
|
||||
// The request was made but no response was received
|
||||
title = "Problem with request!";
|
||||
msg = "Error occured due to wrong server request!"
|
||||
console.log(error.request);
|
||||
} else {
|
||||
// Something happened in setting up the request that triggered an Error
|
||||
title = "Error";
|
||||
msg = error.message;
|
||||
console.log('Error', error.message);
|
||||
}
|
||||
console.log(error.config);
|
||||
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', { message: msg, title: title, });
|
||||
})
|
||||
this.cacheName = cache.name;
|
||||
this.cacheID = this.$route.params.cache;
|
||||
})
|
||||
},
|
||||
|
||||
setParams() {
|
||||
@ -197,10 +152,12 @@
|
||||
this.$axios.get('/api/checkStation', {params})
|
||||
.then((response) => {
|
||||
console.log("resolve(true)");
|
||||
console.log("cache access definition");
|
||||
console.log(response.data.cacheAccesDefinition);
|
||||
resolve(true);
|
||||
if (response.data.cache_acces_definition === 0) {
|
||||
if (Number(response.data.cacheAccesDefinition.id) === 0) {
|
||||
this.$router.push({path: `/station/${params.cacheID}/${params.stationID}`});
|
||||
} else if (response.data.cache_acces_definition === 1) {
|
||||
} else if (Number(response.data.cacheAccesDefinition.id) === 1) {
|
||||
this.$router.push({path: `/CacheEnd/${params.cacheID}`});
|
||||
}
|
||||
}).catch((error) => {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<div v-if="askForPermission">
|
||||
<div >
|
||||
<div class="q-ma-md" v-if="askForPermission">
|
||||
<p>Um den QR-Code scannen zu können, müssen Sie den Zugriff auf Ihre Kamera erlauben.</p>
|
||||
|
||||
<q-btn @click="toggleCamera(!activateCamera)" :loading="loading" unelevated color="positive" stack
|
||||
@ -61,12 +61,18 @@
|
||||
|
||||
validate() {
|
||||
return new Promise(resolve => {
|
||||
this.setParams(0);
|
||||
let params = this.params;
|
||||
let params = this.setParams();
|
||||
this.$axios.get('/api/checkStation', {params})
|
||||
.then((response) => {
|
||||
console.log("resolve(true)");
|
||||
resolve(true)
|
||||
console.log("cache access definition");
|
||||
console.log(response.data.cacheAccesDefinition);
|
||||
resolve(true);
|
||||
if (Number(response.data.cacheAccesDefinition.id) === 0) {
|
||||
this.$router.push({path: `/station/${params.cacheID}/${params.stationID}`});
|
||||
} else if (Number(response.data.cacheAccesDefinition.id) === 1) {
|
||||
this.$router.push({path: `/CacheEnd/${params.cacheID}`});
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.log("resolve(false)");
|
||||
// Error
|
||||
@ -96,20 +102,17 @@
|
||||
})
|
||||
},
|
||||
|
||||
setParams(cacheID) {
|
||||
setParams() {
|
||||
console.log("setParams: ");
|
||||
let resCacheID = this.result.split('/')[0];
|
||||
let resStationID = this.result.split('/')[1];
|
||||
console.log(resCacheID + " und " + resStationID);
|
||||
this.params = {
|
||||
token: null,
|
||||
cacheID: resCacheID,
|
||||
stationID: resStationID,
|
||||
durchgefuehrterCacheID: cacheID
|
||||
};
|
||||
let params = {};
|
||||
params.cacheID = this.result.split('/')[0];
|
||||
params.stationID = this.result.split('/')[1];
|
||||
params.durchgefuehrterCacheID = params.cacheID;
|
||||
console.log(params.cacheID + " und " + params.stationID);
|
||||
if (localStorage.getItem('userToken')) {
|
||||
this.params.token = JSON.parse(localStorage.getItem('userToken')).token;
|
||||
params.token = JSON.parse(localStorage.getItem('userToken')).token;
|
||||
}
|
||||
return params;
|
||||
},
|
||||
|
||||
pauseCamera() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user