elearning/frontend_management/middleware/auth.ts
2026-01-12 16:49:58 +07:00

7 lines
No EOL
194 B
TypeScript

export default defineNuxtRouteMiddleware((to, from) => {
const authStore = useAuthStore();
authStore.checkAuth();
if (!authStore.isAuthenticated) {
return navigateTo('/login');
}
});