moved to bootstrap-vue, there is a bug in vee-validate and bootstrap-vue >rc15
This commit is contained in:
165
src/router.ts
165
src/router.ts
@@ -3,97 +3,110 @@ import Router from 'vue-router';
|
||||
import Home from './views/Home.vue';
|
||||
import NotFound from './views/NotFound.vue';
|
||||
|
||||
import Survey from '@/components/Survey.vue';
|
||||
import NewSurvey from '@/components/NewSurvey.vue';
|
||||
import NewSurvey from '@/components/Rooms.vue';
|
||||
import Login from '@/components/Login.vue';
|
||||
import Admin from '@/components/Admin.vue';
|
||||
import Profile from '@/components/Profile.vue';
|
||||
import User from '@/components/User.vue';
|
||||
import Group from '@/components/Group.vue';
|
||||
import Rooms from '@/components/Rooms.vue';
|
||||
import Recorders from '@/components/Recorders.vue';
|
||||
import store from '@/store';
|
||||
|
||||
Vue.use(Router);
|
||||
|
||||
export const router = new Router({
|
||||
// export default new Router({
|
||||
mode: 'history',
|
||||
base: process.env.BASE_URL,
|
||||
routes: [
|
||||
{
|
||||
path: '/',
|
||||
name: 'home',
|
||||
component: Home,
|
||||
},
|
||||
{
|
||||
path: '/login',
|
||||
name: 'login',
|
||||
component: Login,
|
||||
},
|
||||
{
|
||||
path: '/admin',
|
||||
name: 'admin',
|
||||
component: Admin,
|
||||
children: [
|
||||
mode: 'history',
|
||||
base: process.env.BASE_URL,
|
||||
routes: [
|
||||
{
|
||||
name: 'admin.user',
|
||||
path: 'user',
|
||||
component: User,
|
||||
path: '/',
|
||||
name: 'home',
|
||||
component: Home,
|
||||
},
|
||||
{
|
||||
name: 'admin.group',
|
||||
path: 'group',
|
||||
component: Group,
|
||||
path: '/login',
|
||||
name: 'login',
|
||||
component: Login,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: '/about',
|
||||
name: 'about',
|
||||
// route level code-splitting
|
||||
// this generates a separate chunk (about.[hash].js) for this route
|
||||
// which is lazy-loaded when the route is visited.
|
||||
component: () => import(/* webpackChunkName: "about" */ './views/About.vue'),
|
||||
}, {
|
||||
path: '/surveys/:id',
|
||||
name: 'Survey',
|
||||
component: Survey,
|
||||
}, {
|
||||
path: '/surveys',
|
||||
name: 'NewSurvey',
|
||||
component: NewSurvey,
|
||||
beforeEnter(to, from, next) {
|
||||
if (!store.getters.isAuthenticated) {
|
||||
next('/login');
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
},
|
||||
}, {
|
||||
path: '/profile',
|
||||
name: 'Profile',
|
||||
component: Profile,
|
||||
beforeEnter(to, from, next) {
|
||||
if (!store.getters.isAuthenticated) {
|
||||
Vue.$log.debug('not authenticated!');
|
||||
if (store.getters.isRefreshTokenValid) {
|
||||
Vue.$log.debug('refresh token is still valid :)');
|
||||
store.dispatch('refreshToken')
|
||||
.then(() => next())
|
||||
.catch(() => next('/login'));
|
||||
} else {
|
||||
next('/login');
|
||||
}
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '*',
|
||||
name: 'notFound',
|
||||
component: NotFound,
|
||||
},
|
||||
],
|
||||
{
|
||||
path: '/admin',
|
||||
name: 'admin',
|
||||
component: Admin,
|
||||
children: [
|
||||
{
|
||||
name: 'admin.user',
|
||||
path: 'user',
|
||||
component: User,
|
||||
},
|
||||
{
|
||||
name: 'admin.group',
|
||||
path: 'group',
|
||||
component: Group,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: '/about',
|
||||
name: 'about',
|
||||
// route level code-splitting
|
||||
// this generates a separate chunk (about.[hash].js) for this route
|
||||
// which is lazy-loaded when the route is visited.
|
||||
component: () => import(/* webpackChunkName: "about" */ './views/About.vue'),
|
||||
}, {
|
||||
path: '/surveys/:id',
|
||||
name: 'Survey',
|
||||
component: Rooms,
|
||||
}, {
|
||||
path: '/rooms',
|
||||
name: 'rooms',
|
||||
component: Rooms,
|
||||
}, {
|
||||
path: '/recorders',
|
||||
name: 'recorders',
|
||||
component: Recorders,
|
||||
}, {
|
||||
path: '/commands',
|
||||
name: 'commands',
|
||||
component: Rooms,
|
||||
}, {
|
||||
path: '/surveys',
|
||||
name: 'NewSurvey',
|
||||
component: NewSurvey,
|
||||
beforeEnter(to, from, next) {
|
||||
if (!store.getters.isAuthenticated) {
|
||||
next('/login');
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
},
|
||||
}, {
|
||||
path: '/profile',
|
||||
name: 'Profile',
|
||||
component: Profile,
|
||||
beforeEnter(to, from, next) {
|
||||
if (!store.getters.isAuthenticated) {
|
||||
Vue.$log.debug('not authenticated!');
|
||||
if (store.getters.isRefreshTokenValid) {
|
||||
Vue.$log.debug('refresh token is still valid :)');
|
||||
store.dispatch('refreshToken')
|
||||
.then(() => next())
|
||||
.catch(() => next('/login'));
|
||||
} else {
|
||||
next('/login');
|
||||
}
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '*',
|
||||
name: 'notFound',
|
||||
component: NotFound,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export default router;
|
||||
|
||||
Reference in New Issue
Block a user