check delle autorizzazioni di accesso area su url di navigazione

This commit is contained in:
Paolo Possanzini
2018-01-16 18:17:55 +01:00
parent be1e491ad9
commit 3d2abb8ca4
2 changed files with 12 additions and 3 deletions
+11 -2
View File
@@ -2,9 +2,10 @@ import Vue from "vue";
import VueRouter from "vue-router";
import VeeValidate from "vee-validate";
import "./_base/gestures";
import "./app.modules";
import { store, machineStatusActions } from "./store";
const App = () =>
import ("./App.vue");
@@ -20,6 +21,14 @@ router.addRoutes(routes);
// manipulate the title page
router.beforeEach((to, from, next) => {
if (to.meta && to.meta.area) {
// Check if area is enabled
if (!machineStatusActions.isAreaEnabled(store, to.meta.area)) {
next({
path: '/'
})
}
}
if (to.meta && to.meta.title) {
window.document.title = to.meta.title;
}
@@ -27,7 +36,7 @@ router.beforeEach((to, from, next) => {
});
import { store } from "./store";
let v = new Vue({