import Vue from 'vue'; import Router from 'vue-router'; import Home from './views/pub/Home.vue'; import Login from './views/auth/Login.vue' import Dashboard from './views/site/Dashboard.vue' import Kanban from './views/site/Kanban.vue' import Tutorials from './views/site/Tutorials.vue' import Settings from './views/site/Settings.vue' import SiteIndex from './views/site/Index.vue' import Admin from "@/views/admin/Admin"; import AdminIndex from "@/views/admin/Index"; import Index from "@/views/error/Index"; import error403 from "@/views/error/error403.vue"; import error404 from "@/views/error/error404.vue"; import LegalNotice from "@/views/pub/LegalNotice"; import DataPrivacy from "@/views/pub/DataPrivacy"; import Tasks from "@/views/site/Tasks"; Vue.use(Router); const routes = [ { path: '', name: 'pub-home', component: Home, }, { path: '/legal-notice', name: 'pub-legal-notice', component: LegalNotice, }, { path: '/data-protection-declaration', name: 'pub-data-privacy', component: DataPrivacy, }, { path: '/login', name: 'auth-login', component: Login, props: true, }, { path: '/register', name: 'auth-register', redirect: {name: 'auth-login'} }, { path: '/dashboard', component: SiteIndex, meta: { auth: 'user', // replace with true to allow admins as well, alternatively ['admin', 'user'] }, children: [ { path: '', name: 'user-landing', redirect: {name: 'site-dashboard'}, }, { path: '/dashboard', name: 'site-dashboard', component: Dashboard, props: true, }, { path: '/kanban', component: Kanban, props: true, children: [ { path: '', name: 'site-kanban', }, { path: '/kanban/:cycleId', name: 'site-kanban-id', } ] }, { path: '/tutorials', name: 'site-tutorials', component: Tutorials, }, { path: '/tasks', name: 'site-tasks', component: Tasks, }, { path: '/settings', name: 'site-settings', component: Settings, }, ] }, { path: '/admin', component: AdminIndex, meta: { auth: 'admin' }, children: [ { path: '', name: 'admin-landing', redirect: {name: 'admin-admin'}, }, { path: '/admin', name: 'admin-admin', component: Admin, }, ] }, { path: '/', component: Index, children: [{ path: '403', name: 'error-403', component: error403, }, { path: '*', name: 'error-404', component: error404, }] } ]; Vue.router = new Router({ mode: 'history', routes: routes, }); export default Vue.router;