Files
pichunt/app/middleware/auth.ts
T
2025-08-04 19:34:50 +02:00

9 lines
225 B
TypeScript

export default defineNuxtRouteMiddleware((to) => {
const { loggedIn } = useUserSession();
if (!loggedIn.value) {
const localePath = useLocalePath();
return navigateTo(localePath(`/login?to=${to.path}`));
}
});