export default defineNuxtRouteMiddleware(async (to) => { const { loggedIn } = useAuth() // if authenticated, and on a signin/signup page, redirect to home page if (to.path.toLowerCase().includes('/auth/') && loggedIn.value) { return navigateTo('/') } // If not authenticated, and not on a signin/signup page, redirect to login page if (!loggedIn.value && !to.path.toLowerCase().includes('/auth/')) { return navigateTo('/auth/login') } })