Closed guilherme-codes closed 1 week ago
Hi @guilherme-codes
Can you please try with this version and confirm that the fix works?
pnpm add https://pkg.pr.new/atinux/nuxt-auth-utils@278
Then start again your development server and try to reproduce your issue.
It works well. Thanks
You can now use https://github.com/atinux/nuxt-auth-utils/releases/tag/v0.5.3 :)
@atinux I'm curious (on a module author's perspective) to understand something in your fix (https://github.com/atinux/nuxt-auth-utils/pull/278/commits/065c54dba8e2b06b356de421bca4a91881158a4f)
What was causing it? Was it the fact that fetch
and clear
where defined outside useUserSession
?
I'm using TanStack to fetch and cache my data, so I created a plugin to manage it. After three retries I'd like to redirect the user to the auth path and clear the session. The problem is that I'm receiving the famous "A composable that requires access to the Nuxt instance was called outside of a plugin..." error.
I tried to use
nuxtApp.runWithContext(() => {})
to manage it but unfortunately doesn't work.Is there any way to fix it @atinux?? I'll place my code below to make it easy to understand.