- catalog: badge ORGANISÉ/PARTIEL/EN COURS sur les affiches (download_state) - catalog: filtres Téléchargés et En cours - catalog: icône logs dans le header - catalog: polling notifications organisation (toast auto) - api: /api/series enrichi avec download_state par série - api: /api/logs + /api/logs/clear avec filtre level/source/limit - api: /api/downloads enrichi avec errorFiles depuis recentOrganized - logger: module centralisé logs.jsonl, rotation 2000 lignes, debug masqué en prod - downloads: badge erreurs avec tooltip fichiers en erreur au hover - downloads: badge organisation NON ORGANISÉ/EN COURS/ORGANISÉ avec compteur - logs: page /logs avec table, filtres niveau/source, choix 100/500/tout, taille fichier, clear - organize: callback onResult expose errorFiles - organize-worker: logs candidats absents passés en debug
56 lines
1.3 KiB
TypeScript
56 lines
1.3 KiB
TypeScript
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')
|
|
},
|
|
{
|
|
path: '/logs',
|
|
component: () => import('@/views/LogsView.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 |