mirror of
https://git.meshkee.com/cssd/cssd-back.git
synced 2026-10-10 19:31:07 +03:30
change home
This commit is contained in:
Vendored
+6
-3
@@ -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();
|
||||
});
|
||||
|
||||
|
||||
Vendored
+4
-1
@@ -8,7 +8,10 @@ export default [
|
||||
{
|
||||
path: '/',
|
||||
name: 'home',
|
||||
view: 'Home/Intro'
|
||||
view: 'Home/Intro',
|
||||
// meta : {
|
||||
// onlyWhenLoggedOut : true
|
||||
// }
|
||||
},
|
||||
{
|
||||
path: '/Show/Item/:item',
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
<v-toolbar-title >CSSD-DOC</v-toolbar-title>
|
||||
<v-spacer></v-spacer>
|
||||
<div class="my-2">
|
||||
<a href="/dashboard"><v-btn color="black">Login</v-btn></a>
|
||||
<a href="/dashboard" v-if="auth"><v-btn color="black">Dashboard</v-btn></a>
|
||||
<a href="/login" v-else><v-btn color="black">Login</v-btn></a>
|
||||
</div>
|
||||
</v-toolbar>
|
||||
<v-parallax src="img/Static/Intro/bg.jpg" height="600">
|
||||
@@ -162,9 +163,11 @@
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
import { TokenService } from '@/services/auth/storage.service'
|
||||
|
||||
export default {
|
||||
data: () => ({
|
||||
auth : false,
|
||||
items: {
|
||||
items1 : [
|
||||
'Physical Parameters, STEAM',
|
||||
@@ -198,6 +201,9 @@ export default {
|
||||
|
||||
},
|
||||
created(){
|
||||
if(TokenService.getToken()){
|
||||
this.auth = true;
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
Vendored
+2
-2
@@ -59,7 +59,7 @@ router.beforeEach((to, from, next) => {
|
||||
const onlyWhenLoggedOut = to.matched.some(record => record.meta.onlyWhenLoggedOut);
|
||||
const loggedIn = !!TokenService.getToken();
|
||||
const roles = (to.meta && to.meta.roles) ? to.meta.roles : null;
|
||||
|
||||
|
||||
if (!isPublic && !loggedIn) {
|
||||
return next({
|
||||
path:'/login',
|
||||
@@ -68,7 +68,7 @@ router.beforeEach((to, from, next) => {
|
||||
}
|
||||
|
||||
// Do not allow user to visit login page or register page if they are logged in
|
||||
if (loggedIn && onlyWhenLoggedOut && policy) {
|
||||
if (loggedIn && onlyWhenLoggedOut ) {
|
||||
return next('/')
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user