-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SWR + Nuxt auth utils #311
Comments
Actually it can happen after the nuxt-auth-utils/src/runtime/app/plugins/session.client.ts Lines 11 to 13 in ec9b727
What behavior are you trying to achieve? What API call do you need to make? |
Thanks for the reply @atinux 🙏 Favorites are useful at this step because there is a list of items displayed and if an item is favorited, I display it on the screen. Hope that makes sense |
What about using directly the fetch hooks in a nitro plugin so the fetch of the session already has the data you need? https://github.com/atinux/nuxt-auth-utils?tab=readme-ov-file#extend-session |
I've used a client plugin
and it works I think it's easier to use a client plugin and a composable in my case, as the list of favorites or collections will be updated on the client side. Unless a Nitro plugin can update a composable? Question aside: how can i read/learn about best nuxt architecture choices? I've been using nuxt since 2019 and still struggle with some design choices |
I'm using nuxt swr with nuxt auth utils
nuxt.config.ts
in my app.vue
The template part with AuthState works well
When i'm visiting swr route, loggedIn is false and it's true when visiting ssr routes
According to the docs when using hybrid rendering the session is fetched on client side so it should be done on onMounted
What am i missing here? am i using the wrong hook?
Thanks for the help
The text was updated successfully, but these errors were encountered: