filegator/frontend/router.js

35 lines
645 B
JavaScript
Raw Normal View History

2019-06-13 18:52:40 +02:00
import Vue from 'vue'
import Router from 'vue-router'
import Browser from './views/Browser.vue'
import Users from './views/Users.vue'
import Login from './views/Login.vue'
import store from './store'
Vue.use(Router)
export default new Router({
mode: 'hash',
routes: [
{
path: '/',
name: 'browser',
component: Browser,
},
{
path: '/login',
name: 'login',
component: Login,
},
{
path: '/users',
name: 'users',
component: Users,
beforeEnter: (to, from, next) => {
if (store.state.user.role == 'admin') {
next()
}
},
},
]
})