useDirectusAuth creates warning when used in middleware
Dominic-Marcelino opened this issue · 1 comments
Dominic-Marcelino commented
When using useDirectusAuth() in a midleware, nuxt warns about the usage of useRoute
in a middleware.
As the route is only needed for the loginWithProvider()
function, I'd suggest to move the const route = useRoute()
into the desired function.
Version
nuxt-directus 5.4.4
nuxt: 3.6.1
Reproduction Link
Steps to reproduce
- Use
useDirectusAuth
auth in a middleware
What is Expected?
- No warning
What is actually happening?
Nuxt throws a warning:
[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.
Intevel commented
Fixed in newest Commit