87 lines
1.6 KiB
JavaScript
87 lines
1.6 KiB
JavaScript
import { createRouter, createWebHistory } from 'vue-router'
|
|
import LoginForm from '@/components/LoginForm'
|
|
import Quotes from '@/components/quotes'
|
|
import Pages from '@/components/pages/PagesIndex'
|
|
import PagesEdit from '@/components/pages/edit'
|
|
import ProjectsList from '@/components/projects'
|
|
import ProjectsDetails from '@/components/projects/ProjectDetails'
|
|
import BlogIndex from '@/components/blog/BlogIndex'
|
|
import BlogPost from '@/components/blog/BlogPost'
|
|
import ProfileView from '@/components/users/ProfileView'
|
|
import TheAbout from '@/components/TheAbout'
|
|
import NotFound from '@/components/NotFound'
|
|
|
|
const routes = [
|
|
{
|
|
path: '/',
|
|
name: 'Home',
|
|
component: Quotes
|
|
},
|
|
{
|
|
path: '/about',
|
|
name: 'About',
|
|
component: TheAbout
|
|
},
|
|
{
|
|
path: '/form_login',
|
|
name: 'LoginForm',
|
|
component: LoginForm
|
|
},
|
|
{
|
|
path: '/projects',
|
|
name: 'Projects',
|
|
component: ProjectsList
|
|
},
|
|
{
|
|
path: '/projects/:id',
|
|
name: 'ProjectDetails',
|
|
component: ProjectsDetails
|
|
},
|
|
{
|
|
path: '/blog',
|
|
name: 'Blog',
|
|
component: BlogIndex
|
|
},
|
|
{
|
|
path: '/blog/post/:id',
|
|
name: 'BlogPost',
|
|
component: BlogPost
|
|
},
|
|
{
|
|
path: '/pages/:slug',
|
|
name: 'Pages',
|
|
component: Pages,
|
|
props: true
|
|
},
|
|
{
|
|
path: '/pages/edit/:slug',
|
|
component: PagesEdit,
|
|
meta: { requiredAuth: true }
|
|
},
|
|
{
|
|
path: '/profile/:username?',
|
|
name: 'Profile',
|
|
component: ProfileView
|
|
},
|
|
{
|
|
path: '/:pathMatch(.*)*',
|
|
name: 'NotFound',
|
|
component: NotFound
|
|
}
|
|
]
|
|
|
|
const router = createRouter({
|
|
history: createWebHistory(),
|
|
routes
|
|
})
|
|
|
|
/*
|
|
router.beforeEach((to) => {
|
|
if (to.meta.requiredAuth && !window.user) {
|
|
return { name: 'LoginForm' }
|
|
}
|
|
})
|
|
|
|
*/
|
|
export default router
|