Skip to content
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

User data not saved by store.dispatch #142

Open
karmamaster opened this issue Feb 2, 2021 · 1 comment
Open

User data not saved by store.dispatch #142

karmamaster opened this issue Feb 2, 2021 · 1 comment

Comments

@karmamaster
Copy link

I am using a template that require to access to $auth.user info (which saved by auth/fetchUser in login page), but it seems that it is not saved in auth variable by store.dispatch cause it is undefined when i tried to access it by: return this.$auth.user.photo_url

I have double check the api code and it is working well, the json returned and fetched by auth/fetchUser api, the issue here is I user info not save to auth.

I was tried to looking around and they suggested to add property: false to nuxt.config.js file, but I found that this @cretueusebiu is using custom middleware to check auth user, so there is no auth package to setting it in config file :(.

Anyone help me please!

@maprangsoft
Copy link

@karmamaster i use plugins for this case

  1. create auth.js in plugins folder
    Screen Shot 2564-02-16 at 23 33 24

  2. in nuxt.config.js
    1613493263196

  3. can use $auth.user in template or script
    1613493904770

  4. result
    Screen Shot 2564-02-16 at 23 40 41

Screen Shot 2564-02-16 at 23 43 06

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants