N
Nuxt4mo ago
David

UseRoute within middleware (nuxt content)

Hello everyone, I have this warning when I return to the home (/)
[nuxt] Calling `useRoute` within middleware may lead to misleading results. Instead, use the (to, from) arguments passed to the middleware to access the new and old routes.
[nuxt] Calling `useRoute` within middleware may lead to misleading results. Instead, use the (to, from) arguments passed to the middleware to access the new and old routes.
3 Replies
Cake
Cake4mo ago
ok maybe consider sharing some code
Kyllian
Kyllian4mo ago
try using navigateTo()
David
David3mo ago
I have just one middleware :
export default defineNuxtRouteMiddleware((to) => {
if (to.path === '/docs') {
return navigateTo('/docs/getting-started')
}
})
export default defineNuxtRouteMiddleware((to) => {
if (to.path === '/docs') {
return navigateTo('/docs/getting-started')
}
})
But the page at / is not concerned by this middleware I have found on the an issue that says it is because I do not have index.md for the route but I have not need this
Want results from more Discord servers?
Add your server