added new login code and testing components

This commit is contained in:
2019-03-21 16:13:57 +01:00
parent 18f22fdffa
commit e04da5b273
11 changed files with 587 additions and 9 deletions

View File

@@ -3,6 +3,11 @@ 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 Login from '@/components/Login.vue';
import store from '@/store'
Vue.use(Router);
export default new Router({
@@ -21,6 +26,25 @@ export default new Router({
// 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: '/login',
name: 'Login',
component: Login
},
{
path: '*',