-
Notifications
You must be signed in to change notification settings - Fork 927
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
Nuxt auth page reload problem #1283
Comments
Yes the user has the name property. When it redirects from login to profile
it show all. But after refresh it throws error.
…On Wed, Sep 1, 2021, 12:13 AM Cody Bontecou ***@***.***> wrote:
This line <h6 class="font-semibold text-lg">{{$auth.user.name}}</h6> is
probably what's causing the issue. Are you sure your user has a name value?
Check your dev tools vuex User value to see if your user state has a name
value. If not, make sure your backend is providing the data you expect.
[image: Screen Shot 2021-08-31 at 13 10 58]
<https://user-images.githubusercontent.com/20440899/131554601-9685e6ab-843e-49ce-873b-cee68b45605c.png>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1283 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKBDWJJSHVEEXQ335YIQB2LT7ULVRANCNFSM5DET3VNA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Shouldn't be a problem with axios or nuxt-auth. for the first maybe use v-if here
and check if after refresh the page there is going a request to the endpoint which fetch user data mostly -> auth/me set by default in nuxt-auth. Check the vue-dev-tools if $auth.user exist |
If you set the ssr: false in file nuxt.config.js then the problem will be solved. |
Yeah, I have the exact problem. Auth middleware does not recognize user is logged in when on ssr mode. |
Same problem here |
I've fixed it by passing |
Do you have an example of your implementation ? Thank you |
Sure, here I completely explained it: |
Unfortunately, this is not working |
i have same problem, but now i fixed it then in the endpoint setting in nuxt/auth, i remove the /api (proxy) only on user endpoint and dont forget to setting autofetch to false, because this run in client side, and because we remove the proxy(/api) from user endpoint it will cause error 404 not found so when the login page we manually fetch the user you can see my full config for nuxt/auth here https://pastebin.com/9d5PbfBN |
I think all the tips here are already captured in #1197 |
Version
module: ^5.0.0-1624817847.21691f1
nuxt: "^2.15.7"
When I log in with nuxt auth, I redirect the user to his profile page. But after reload on the profile page I get an error like this:
Can not read property 'name' of null
I have searched this problem related to @nuxtjs/auth-next ssr problem. Most of the solution is to downgrade the @nuxtjs/axios version. I have already tried this but not fixed.
Here is my profile page code:
The text was updated successfully, but these errors were encountered: