feat: initial project

This commit is contained in:
MasutaYunikon committed 2026-03-10 22:36:34 +01:00
commit eaf01cfc59
38 files changed
+5807

No files matched your search

+52
View File
@@ -0,0 +1,52 @@
import { createRouter, createWebHistory } from 'vue-router'
import { useAuthStore } from '@/stores/auth'
const router = createRouter({
history: createWebHistory(),
routes: [
{
path: '/auth',
component: () => import('@/views/AuthView.vue'),
meta: { public: true }
},
{
path: '/',
name: 'catalog',
component: () => import('@/views/CatalogView.vue')
},
{
path: '/series/:id',
component: () => import('@/views/SerieView.vue')
},
{
path: '/downloads',
component: () => import('@/views/DownloadsView.vue')
},
{
path: '/settings',
component: () => import('@/views/SettingsView.vue')
}
],
scrollBehavior(to, _from, savedPosition) {
if (savedPosition) return savedPosition
return { top: 0 }
}
})
router.beforeEach(async (to) => {
const auth = useAuthStore()
if (auth.loading) {
await auth.checkStatus()
}
if (!to.meta.public && !auth.loggedIn) {
return '/auth'
}
if (to.path === '/auth' && auth.loggedIn) {
return '/'
}
})
export default router