GithubHelp home page GithubHelp logo

Comments (8)

gulipad avatar gulipad commented on May 28, 2024 1

Thanks @sandiprb! Looks like this solves the issue! Thanks!

from strapi.

sandiprb avatar sandiprb commented on May 28, 2024

@gulipad If I understand your problem correctly, I had a similar experience. But then removed the cookie handling and user storing logic from nuxtServerInit() and from the store as well. And started using this.$strapi.user in my code everywhere.

Like this part in docs suggest that on SSR mode nuxt always makes the request to strapi automaticallly if the strapi_jwt cookie is present.

So on first login just set the user & token with methods and rest nuxt shoulld take care of it.

from strapi.

bubbleis avatar bubbleis commented on May 28, 2024

Hey guys, hi there!
The problem persists, but in another way.
And maybe i'm not doing something well.

The problem is next.
When i'm logging in, i have the next response for my $strapi.user:
image
U can see the structure that have user object.

After a page refresh i get this structure using $strapi.user:
image

As u can see, there are some missing properties.

I hope u can help me with this one.
Thank you in advance <3

from strapi.

gulipad avatar gulipad commented on May 28, 2024

from strapi.

bubbleis avatar bubbleis commented on May 28, 2024

Hi there,
@gulipad reopen it please.

@sandiprb please take a look at the my previous comment, thanks in advance

from strapi.

gulipad avatar gulipad commented on May 28, 2024

@bubbleis I think a new issue should be opened, this was a different issue by which I could not access any data of the user.

from strapi.

bubbleis avatar bubbleis commented on May 28, 2024

@gulipad hmmm, ok, ty )

from strapi.

merijnponzo avatar merijnponzo commented on May 28, 2024

Hi,
I noticed that $strapi.login does populate and return a full user object (if your user has relations, most of the will be returned as full objects as well)

But $strapi.fetchUser doesn't
Within your dashboard.vue / or whatever route to the user dashboard you can add your wanted object to create a full strapi user object again

 middleware: 'isAuthenticated',
  async asyncData({ $typy, $strapi }) {
    // by default $strapi.user is not populated, so add the kennel as an object
    if ($typy($strapi, 'user.house').isNumber) {
      const house = await $strapi.$houses.findOne($strapi.user.house)
      // add a reactive house object
      const user = { ...$strapi.user }
      user.house = kennel
      $strapi.setUser(user)

from strapi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.