feat(portal): login, dashboard, event switcher, password reset flow
Made-with: Cursor
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import type { Router } from 'vue-router'
|
||||
import { useAuthStore } from '@/stores/useAuthStore'
|
||||
|
||||
const guestOnlyPaths = ['/login', '/wachtwoord-vergeten', '/wachtwoord-resetten']
|
||||
|
||||
export function setupGuards(router: Router) {
|
||||
router.beforeEach(async (to) => {
|
||||
const authStore = useAuthStore()
|
||||
@@ -13,10 +15,10 @@ export function setupGuards(router: Router) {
|
||||
|
||||
// Public routes — no auth check needed
|
||||
if (!requiresAuth) {
|
||||
// Redirect authenticated users away from login
|
||||
if (authStore.isAuthenticated && to.path === '/login') {
|
||||
if (authStore.isAuthenticated && guestOnlyPaths.some(p => to.path === p || to.path.startsWith(`${p}/`))) {
|
||||
return { path: '/dashboard' }
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user