diff --git a/frontend/src/layouts/MyLayout.vue b/frontend/src/layouts/MyLayout.vue
index 49ffc82..6b82285 100644
--- a/frontend/src/layouts/MyLayout.vue
+++ b/frontend/src/layouts/MyLayout.vue
@@ -105,6 +105,23 @@
+
+
+
+
+ Fehler
+
+
+
+ {{ dialogMessage }}
+
+
+
+
+
+
+
+
@@ -115,14 +132,54 @@
name: "MyLayout",
data() {
return {
+ // dialog: {
+ // color: this,
+ // show: true,
+ // message: "Hallo Fehler! Dies ist ein Beispiel Fehler."
+ // },
leftDrawerOpen: this.$q.platform.is.desktop,
//menuButtonVisible: !this.$q.platform.is.desktop,
//leftDrawerOpen: true,
//miniState: true
};
},
+ computed: {
+ dialogShow: {
+ get() {
+ console.log("get dialogShow: "+this.$store.state.dialog.dialog.show)
+ return this.$store.state.dialog.dialog.show;
+ },
+ set(val) {
+ console.log("set dialogShow: "+val)
+ this.$store.state.dialog.dialog.show = val;
+ }
+ },
+ dialogMessage: {
+ get() {
+ console.log("get dialogMessage: "+this.$store.state.dialog.dialog.message)
+ return this.$store.state.dialog.dialog.message;
+ },
+ },
+ dialogColorBg: {
+ get() {
+ console.log("get dialogColorBg: " + this.$store.state.dialog.dialog.colorBackground)
+ return this.$store.state.dialog.dialog.colorBackground;
+ },
+ },
+ dialogColorBtn: {
+ get() {
+ console.log("get dialogColorBtn: "+this.$store.state.dialog.dialog.colorButton)
+ return this.$store.state.dialog.dialog.colorButton;
+ },
+ }
+ },
methods: {
- openURL
+ //openURL
+ dialogClose() {
+ console.log("dialogClose(): ")
+ this.$store.commit('dialog/RESET_MESSAGE_DIALOG');
+ },
+
}
};
diff --git a/frontend/src/pages/Overview.vue b/frontend/src/pages/Overview.vue
index f8550fb..bb66a29 100644
--- a/frontend/src/pages/Overview.vue
+++ b/frontend/src/pages/Overview.vue
@@ -74,21 +74,6 @@
-
-
-
- Fehler
-
-
-
- {{ dialogMsg }}
-
-
-
-
-
-
-
@@ -107,8 +92,6 @@
return {
tab: 'list',
caches: [],
- dialog: false,
- dialogMsg: "",
}
},
mounted: function () {
diff --git a/frontend/src/pages/Profile.vue b/frontend/src/pages/Profile.vue
index f22177b..8a48bea 100644
--- a/frontend/src/pages/Profile.vue
+++ b/frontend/src/pages/Profile.vue
@@ -29,7 +29,7 @@
-
@@ -64,7 +64,7 @@
@@ -83,6 +82,8 @@
console.log("Rankinglist: ");
console.log(response.data);
this.rankinglist = response.data;
+ }).catch((error) => {
+ this.$store.commit('dialog/NEW_MESSAGE_DIALOG', { message: error })
})
}
}
diff --git a/frontend/src/router/routes.js b/frontend/src/router/routes.js
index 0024f01..bd39bb2 100644
--- a/frontend/src/router/routes.js
+++ b/frontend/src/router/routes.js
@@ -25,22 +25,21 @@ const routes = [
component: () => import("layouts/MyLayout.vue"),
children: [{ path: "", component: () => import("pages/StationEdit.vue") }]
},
+ {
+ path: "/station-l/:pos",
+ component: () => import("layouts/MyLayout.vue"),
+ children: [{path: "", component: () => import("pages/StationEdit.vue")}]
+ },
{
path: "/station/:cache/:id",
component: () => import("layouts/MyLayout.vue"),
children: [{ path: "", component: () => import("pages/StationView.vue") }]
},
{
- path: "/station-l/:pos",
path: "/ranking/",
component: () => import("layouts/MyLayout.vue"),
children: [{path: "", component: () => import("pages/ranking.vue")}]
},
-{
- path: "/station/",
- component: () => import("layouts/MyLayout.vue"),
- children: [{ path: "", component: () => import("pages/StationEdit.vue") }]
- },
{
path: "/login/",
component: () => import("layouts/MyLayout.vue"),
diff --git a/frontend/src/store/dialog/actions.js b/frontend/src/store/dialog/actions.js
new file mode 100644
index 0000000..4787a5f
--- /dev/null
+++ b/frontend/src/store/dialog/actions.js
@@ -0,0 +1,4 @@
+/*
+export function someAction (context) {
+}
+*/
diff --git a/frontend/src/store/dialog/getters.js b/frontend/src/store/dialog/getters.js
new file mode 100644
index 0000000..cc054a3
--- /dev/null
+++ b/frontend/src/store/dialog/getters.js
@@ -0,0 +1,4 @@
+/*
+export function someGetter (state) {
+}
+*/
diff --git a/frontend/src/store/dialog/index.js b/frontend/src/store/dialog/index.js
new file mode 100644
index 0000000..b41a219
--- /dev/null
+++ b/frontend/src/store/dialog/index.js
@@ -0,0 +1,12 @@
+import state from './state'
+import * as getters from './getters'
+import * as mutations from './mutations'
+import * as actions from './actions'
+
+export default {
+ namespaced: true,
+ state,
+ getters,
+ mutations,
+ actions
+}
diff --git a/frontend/src/store/dialog/mutations.js b/frontend/src/store/dialog/mutations.js
new file mode 100644
index 0000000..cb09e12
--- /dev/null
+++ b/frontend/src/store/dialog/mutations.js
@@ -0,0 +1,47 @@
+
+export function NEW_MESSAGE_DIALOG (state, messageObject) {
+ console.log("NEW_MESSAGE_DIALOG");
+ if (messageObject == null) {
+ state.dialog.show = true;
+ return;
+ }
+ console.log(messageObject);
+
+ if (messageObject.hasOwnProperty('color')) {
+ switch (messageObject.color) {
+ case "red": {
+ let color = "red-9";
+ state.dialog.colorBackground = "bg-"+color+" text-white";
+ state.dialog.colorButton = color;
+ }
+ case "amber": {
+ let color = "amber";
+ state.dialog.colorBackground = "bg-"+color+" text-white";
+ state.dialog.colorButton = color;
+ }
+ case "blue": {
+ let color = "primary";
+ state.dialog.colorBackground = "bg-"+color+" text-white";
+ state.dialog.colorButton = color;
+ }
+ }
+ }
+
+ if (messageObject.hasOwnProperty('title')) {
+ state.dialog.title = messageObject.title;
+ }
+
+ if (messageObject.hasOwnProperty('message')) {
+ state.dialog.message = messageObject.message;
+ }
+
+ state.dialog.show = true;
+}
+export function RESET_MESSAGE_DIALOG (state) {
+ console.log("RESET_MESSAGE_DIALOG");
+ state.dialog.colorBackground = "bg-red-9 text-white";
+ state.dialog.colorButton = "red-9";
+ state.dialog.message = "Ein unbekannter Fehler ist aufgetreten. Bitte versuchen Sie es noch einmal.";
+ state.dialog.title = "Fehler";
+ state.dialog.show = false;
+}
diff --git a/frontend/src/store/dialog/state.js b/frontend/src/store/dialog/state.js
new file mode 100644
index 0000000..6059480
--- /dev/null
+++ b/frontend/src/store/dialog/state.js
@@ -0,0 +1,9 @@
+export default {
+ dialog: {
+ colorBackground: "bg-red-9 text-white",
+ colorButton: "red-9",
+ show: false,
+ title: "Fehler",
+ message: "Ein unbekannter Fehler ist aufgetreten. Bitte versuchen Sie es noch einmal."
+ },
+}
diff --git a/frontend/src/store/index.js b/frontend/src/store/index.js
index 0ce2a96..58a40f8 100644
--- a/frontend/src/store/index.js
+++ b/frontend/src/store/index.js
@@ -3,6 +3,7 @@ import Vuex from "vuex";
import Axios from "axios";
import auth from "./auth"
import cacheCollector from "./cacheCollector"
+import dialog from "./dialog"
// import example from './module-example'
@@ -17,7 +18,8 @@ export default function (/* { ssrContext } */) {
const Store = new Vuex.Store({
modules: {
auth,
- cacheCollector
+ cacheCollector,
+ dialog
},
// enable strict mode (adds overhead!)
@@ -41,6 +43,10 @@ export default function (/* { ssrContext } */) {
const cacheCollector = require('./cacheCollector').default;
store.hotUpdate({ modules: { cacheCollector: newCacheCollector } })
})
+ module.hot.accept(['./dialog'], () => {
+ const dialog = require('./dialog').default;
+ store.hotUpdate({ modules: { dialog: newDialog } })
+ })
}
return Store