nuxt-alt / auth

An alternative module to @nuxtjs/auth
https://nuxt-alt-auth.vercel.app/
MIT License
94 stars 20 forks source link

Warning: "Calling useRoute within middleware may lead to misleading results" #68

Closed meddle1 closed 7 months ago

meddle1 commented 9 months ago

Environment

Nuxt Config

// @ts-ignore export default defineNuxtConfig({ runtimeConfig: {},

modules: [ '@nuxt-alt/auth', '@nuxt-alt/http', '@nuxt-alt/proxy', ], })

Reproduction

I am absolutely sure that the issue is obvious.

Describe the bug

In middleware.ts, you call the redirect function from auth.js. This function calls useRoute and results in a warning.

Additional context

No response

Logs

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.
Denoder commented 9 months ago

pull requests accepted, useRoute doesn't get used unless it's outside of the middleware context. (which some schemes utilize)