diff --git a/frontend/src/boot/axios.js b/frontend/src/boot/axios.js
index 8523d48..ea842da 100644
--- a/frontend/src/boot/axios.js
+++ b/frontend/src/boot/axios.js
@@ -1,7 +1,8 @@
import axios from "axios";
const axiosInstance = axios.create({
- baseURL: process.env.API
+ baseURL: process.env.API,
+ timeout: 3000
});
console.log("process.env.DEV: "+process.env.DEV);
console.log("process.env.API: "+process.env.API);
diff --git a/frontend/src/pages/Cache.vue b/frontend/src/pages/Cache.vue
index e3126cf..db80dbb 100644
--- a/frontend/src/pages/Cache.vue
+++ b/frontend/src/pages/Cache.vue
@@ -1,75 +1,108 @@
-
-
-
- Fehler
-
-
-
- Es konnten keine übereinstimmenden Zugangsdaten in der Datenbank gefunden werden.
-
-
-
-
-
-
-
@@ -68,13 +59,13 @@
export default {
data() {
return {
+ loading: false,
user: {
email: "volkmann@geocaching.de",
password: "0123456789",
//token: "",
// evalAuthentication: false
},
- credentialsDialog: false,
};
},
// beforeMount: {
@@ -97,7 +88,7 @@
},
methods: {
login: function () {
-
+ this.loading = true;
const data = {
email: this.user.email,
password: this.user.password
@@ -135,7 +126,9 @@
}
console.log(error.config);
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', { message: message, title: header, });
- })
+ }).finally(() => {
+ this.loading = false;
+ })
},
evalAuthentication: function () {
this.$store.commit('auth/SET_AUTHENTICATED');
diff --git a/frontend/src/pages/StationEdit.vue b/frontend/src/pages/StationEdit.vue
index f51add4..3e1a6e8 100644
--- a/frontend/src/pages/StationEdit.vue
+++ b/frontend/src/pages/StationEdit.vue
@@ -3,14 +3,16 @@
Neue Station
+ ['bold', 'italic', 'strike', 'underline'],
+ ['undo', 'redo'],
+ ['hr', 'link'],
+ ['fullscreen'],
+ ]"
+ v-model="station.description" min-height="10rem"/>
-
-
-
+
+
+
Location
- Lösung
-
-
+
+
+
@@ -37,6 +40,7 @@
+
+
diff --git a/frontend/src/pages/StationView.vue b/frontend/src/pages/StationView.vue
index 767193d..75fb24a 100644
--- a/frontend/src/pages/StationView.vue
+++ b/frontend/src/pages/StationView.vue
@@ -17,10 +17,29 @@
-
-
-
-
+
+
Um den QR-Code scannen zu können, müssen Sie den Zugriff auf Ihre Kamera erlauben.
+
+
+
+
+
@@ -45,13 +64,25 @@
code: 213812,
solution: "Schneeglöckchen"
}
- }
+ },
+
+ // Following Params belong to QR-Code Scanner
+ askForPermission: true,
+ activateCamera: false,
+ isValid: false,
+ validating: false,
+ loading: false,
+ paused: false,
+ result: null,
+ params: null,
+ noStreamApiSupport: false
+
}
},
created: function () {
console.log("StationView: ")
- console.log("'id' from url: " + this.$route.params.id)
- console.log("'cache' from url: " + this.$route.params.cache)
+ // console.log("'id' from url: " + this.$route.params.id)
+ // console.log("'cache' from url: " + this.$route.params.cache)
this.fetchData();
},
beforeMount: function () {
@@ -129,7 +160,104 @@
console.log(error.config);
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', { message: msg, title: title, });
})
+ },
+
+ setParams() {
+ console.log("setParams: ");
+ let params = {};
+ params.cacheID = this.code.split('/')[0];
+ params.stationID = this.code.split('/')[1];
+ params.durchgefuehrterCacheID = this.cacheID;
+ console.log(params.cacheID + " und " + params.stationID);
+ if (localStorage.getItem('userToken')) {
+ params.token = JSON.parse(localStorage.getItem('userToken')).token;
+ }
+ return params;
+ },
+
+ async onDecode(content) {
+ this.result = content;
+
+ this.pauseCamera();
+
+ this.validating = true;
+ this.isValid = await this.validate();
+ this.validating = false;
+
+ this.unPauseCamera();
+ // window.setTimeout(() => {
+ // this.unPauseCamera();
+ // }, 2000)
+ },
+
+ validate() {
+ return new Promise(resolve => {
+
+ let params = this.setParams();
+ this.$axios.get('/api/checkStation', {params})
+ .then((response) => {
+ console.log("resolve(true)");
+ resolve(true);
+ this.$router.push({path: `/station/${params.cacheID}/${params.stationID}`});
+ }).catch((error) => {
+ console.log("resolve(false)");
+ // 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.data.message
+ ? error.response.data.message
+ : error.response.data;
+ } else if (error.request) {
+ // The request was made but no response was received
+ title = "Problem with request!";
+ msg = "Der Server antwortet nicht."
+ 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.data);
+ }
+ console.log(error.config);
+ this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: msg, title: title,});
+ resolve(false);
+ });
+ })
+ },
+
+ pauseCamera() {
+ this.paused = true
+ },
+
+ unPauseCamera() {
+ this.paused = false
+ },
+
+ toggleCamera(bool) {
+ this.activateCamera = bool
+ },
+
+ logErrors(promise) {
+ promise.catch(console.error)
+ },
+
+ async onInit(promise) {
+ this.loading = true;
+ try {
+ await promise
+ } catch (error) {
+ if (error.name === 'StreamApiNotSupportedError') {
+ this.noStreamApiSupport = true
+ }
+ } finally {
+ this.loading = false;
+ this.askForPermission = false;
+ }
}
+
}
}
diff --git a/frontend/src/router/routes.js b/frontend/src/router/routes.js
index 158b079..1a1e7ff 100644
--- a/frontend/src/router/routes.js
+++ b/frontend/src/router/routes.js
@@ -31,10 +31,20 @@ const routes = [
children: [{ path: "", component: () => import("pages/StationEdit.vue") }]
},
{
- path: "/station-l/:pos",
+ path: "/endstation/",
+ component: () => import("layouts/MyLayout.vue"),
+ children: [{ path: "", component: () => import("pages/StationEndEdit.vue") }]
+ },
+ {
+ path: "/tempstation/:pos",
component: () => import("layouts/MyLayout.vue"),
children: [{path: "", component: () => import("pages/StationEdit.vue")}]
},
+ {
+ path: "/tempendstation/",
+ component: () => import("layouts/MyLayout.vue"),
+ children: [{path: "", component: () => import("pages/StationEndEdit.vue")}]
+ },
{
path: "/station/:cache/:id",
component: () => import("layouts/MyLayout.vue"),
diff --git a/frontend/src/store/cacheCollector/getters.js b/frontend/src/store/cacheCollector/getters.js
index b2b2dbe..d2bea70 100644
--- a/frontend/src/store/cacheCollector/getters.js
+++ b/frontend/src/store/cacheCollector/getters.js
@@ -6,3 +6,7 @@ export const GET_TEMPSTATION = (state) => {
console.log("GET_TEMPSTATION: retrieve cache from store. ");
return state.tempStation;
};
+export const GET_ENDSTATION = (state) => {
+ console.log("GET_ENDSTATION: retrieve cache from store. ");
+ return state.endStation;
+};
diff --git a/frontend/src/store/cacheCollector/mutations.js b/frontend/src/store/cacheCollector/mutations.js
index 383330d..72f58e1 100644
--- a/frontend/src/store/cacheCollector/mutations.js
+++ b/frontend/src/store/cacheCollector/mutations.js
@@ -6,6 +6,10 @@ export const SET_TEMPSTATION = (state, station) => {
console.log("SET_TEMPSTATION: add new station to cache: "+station);
state.tempStation = station;
};
+export const SET_ENDSTATION = (state, station) => {
+ console.log("SET_ENDSTATION: "+station);
+ state.endStation = station;
+};
export const ADD_STATION = (state, station) => {
console.log("ADD_STATION: add new station to cache: "+station);
state.newCache.stationen.push(station);
@@ -29,6 +33,11 @@ export const RESET_NEW_CACHE = (state) => {
rankingPoints: 0,
stationen: []
};
+ state.endStation = {
+ description: "Endstation",
+ longitude: 0.0001,
+ lattitude: 0.0001,
+ };
console.log("resetted new Cache");
};
export const LOAD_REMOTE_CACHE = (state, id) => {
diff --git a/frontend/src/store/cacheCollector/state.js b/frontend/src/store/cacheCollector/state.js
index 7087a3a..0f32de1 100644
--- a/frontend/src/store/cacheCollector/state.js
+++ b/frontend/src/store/cacheCollector/state.js
@@ -3,6 +3,7 @@ export default {
name: "",
description: "",
rankingPoints: 0,
+ reward: "",
stationen: []
},
// newCache: {
@@ -41,4 +42,9 @@ export default {
// ]
// },
tempStation: {},
+ endStation: {
+ description: "Endstation",
+ longitude: 9.206628,
+ lattitude: 49.147734,
+ },
}