mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange.git
synced 2026-08-23 14:24:17 +00:00
make changes in route.js
This commit is contained in:
@@ -3,11 +3,9 @@ import store from '~/store'
|
||||
export default async (to, from, next) => {
|
||||
if (!store.getters['auth/check']) {
|
||||
next({ name: 'login' })
|
||||
}
|
||||
else if (store.getters['auth/user'].role == "admin"){
|
||||
next({ name : 'admin.home' })
|
||||
}
|
||||
else {
|
||||
} else if (store.getters['auth/user'].role === 'admin') {
|
||||
next({ name: 'home' })
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<template>
|
||||
<card :title="$t('home')">
|
||||
This is admin
|
||||
<card>
|
||||
This is home
|
||||
</card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
middleware: 'admin',
|
||||
middleware: ['auth'],
|
||||
|
||||
metaInfo () {
|
||||
return { title: this.$t('home') }
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div>
|
||||
<div class="top-right links">
|
||||
<template v-if="authenticated">
|
||||
<router-link :to="{ name: 'home' }">
|
||||
<router-link :to="{ name: 'admin/home' }">
|
||||
{{ $t('home') }}
|
||||
</router-link>
|
||||
</template>
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
<div class="text-center">
|
||||
<div class="title mb-4">
|
||||
This is admin
|
||||
This index
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -32,7 +32,7 @@ export default {
|
||||
layout: 'basic',
|
||||
|
||||
metaInfo () {
|
||||
return { title: this.$t('home') }
|
||||
// return { title: this.$t('admin.home') }
|
||||
},
|
||||
|
||||
data: () => ({
|
||||
@@ -51,8 +51,3 @@ export default {
|
||||
right: 10px;
|
||||
top: 18px;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 85px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -11,6 +11,8 @@ const Settings = () => import('~/pages/settings/index').then(m => m.default || m
|
||||
const SettingsProfile = () => import('~/pages/settings/profile').then(m => m.default || m)
|
||||
const SettingsPassword = () => import('~/pages/settings/password').then(m => m.default || m)
|
||||
|
||||
// const Admin = () => import('~/pages/admin/adminhome').then(m => m.default || m)
|
||||
const Admin = () => import('~/pages/admin/index').then(m => m.default || m)
|
||||
const AdminHome = () => import('~/pages/admin/home').then(m => m.default || m)
|
||||
|
||||
export default [
|
||||
@@ -31,7 +33,13 @@ export default [
|
||||
{ path: 'password', name: 'settings.password', component: SettingsPassword }
|
||||
] },
|
||||
|
||||
{ path: '/admin', name: 'admin.home', component: AdminHome },
|
||||
{ path: '/admin',
|
||||
component: Admin,
|
||||
children: [
|
||||
{ path: '', redirect: { name: 'admin.index' } },
|
||||
{ path: 'index', name: 'admin.index', component: Admin },
|
||||
{ path: 'home', name: 'admin.home', component: AdminHome }
|
||||
] },
|
||||
|
||||
{ path: '*', component: NotFound }
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user