This commit is contained in:
2026-06-09 23:05:35 +02:00
parent ee2fc42fff
commit eb2652f7e9
27 changed files with 665 additions and 538 deletions
+11 -2
View File
@@ -18,6 +18,11 @@ const router = createRouter({
name: 'login',
component: () => import('@/pages/login.vue'),
},
{
path: '/join',
name: 'join',
component: () => import('@/pages/join.vue'),
},
{
path: '/',
component: Index,
@@ -31,9 +36,13 @@ const router = createRouter({
],
})
router.beforeEach((to, from, next) => {
router.beforeEach(async (to, from, next) => {
const authStore = useAuthStore()
const publicPages = ['login', 'register']
if (!authStore.isInitialized) {
await authStore.initialize()
}
const publicPages = ['login', 'join']
const authRequired = !publicPages.includes(to.name as string)
const adminRequired = to.matched.some(record => record.meta.requiresAdmin)