export default defineNuxtRouteMiddleware(async (to) => { const basePath = stripLocalePrefix(to.path, ['ru', 'en']) // Skip auth routes handled by @logto/nuxt if (basePath === '/sign-in' || basePath === '/sign-out' || basePath === '/callback') { return } // Skip public auth paths if (basePath.startsWith('/auth/')) { return } const { loggedIn } = useAuth() const localePath = useLocalePath() const logtoUser = useState | null>('logto-user', () => null) if (!loggedIn.value && !logtoUser.value) { return navigateTo(localePath('/sign-in')) } })