diff --git a/resources/js/show/router/index.js b/resources/js/show/router/index.js
index e1dd4b9a..2688ff76 100644
--- a/resources/js/show/router/index.js
+++ b/resources/js/show/router/index.js
@@ -10,7 +10,7 @@
import Vue from 'vue'
import Router from 'vue-router'
import Meta from 'vue-meta'
-
+import { TokenService } from '@/services'
// Routes
import paths from './paths'
@@ -47,9 +47,12 @@ Vue.use(Meta)
router.beforeEach((to, from, next) => {
const isPublic = to.matched.some(record => record.meta.public);
const onlyWhenLoggedOut = to.matched.some(record => record.meta.onlyWhenLoggedOut);
- const roles = (to.meta && to.meta.roles) ? to.meta.roles : null;
+ const loggedIn = !!TokenService.getToken();
+
+ if (loggedIn && onlyWhenLoggedOut ) {
+ window.location.href = '/dashboard';
+ }
- // Do not allow user to visit Pages then not access roles
next();
});
diff --git a/resources/js/show/router/paths.js b/resources/js/show/router/paths.js
index d6c85e7e..f211f21b 100644
--- a/resources/js/show/router/paths.js
+++ b/resources/js/show/router/paths.js
@@ -8,7 +8,10 @@ export default [
{
path: '/',
name: 'home',
- view: 'Home/Intro'
+ view: 'Home/Intro',
+ // meta : {
+ // onlyWhenLoggedOut : true
+ // }
},
{
path: '/Show/Item/:item',
diff --git a/resources/js/show/views/Home/Intro.vue b/resources/js/show/views/Home/Intro.vue
index 5b234490..fcfcd24a 100644
--- a/resources/js/show/views/Home/Intro.vue
+++ b/resources/js/show/views/Home/Intro.vue
@@ -4,7 +4,8 @@