added a lot of auth code and resolved merge conflicht

This commit is contained in:
2019-03-21 16:23:04 +01:00
11 changed files with 585 additions and 16 deletions

View File

@@ -5,6 +5,11 @@ import NotFound from './views/NotFound.vue';
import LoginPage from './views/LoginPage.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 const router = new Router({
@@ -28,6 +33,25 @@ export const router = 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: '*',