Skip to content

Proposal to improve the experience of useSession #65

@JoaoPedroAS51

Description

@JoaoPedroAS51

Describe the feature

Hi! I'm João Pedro. I'm one of the maintainers of the nuxt 2 auth module :)

So, currently, each time useSession is used it makes a request to the api to get the session, which means we have to await for the request and this makes the component asynchronous. And if it's used in more than one component, it will make unnecessary requests.

My proposal is to use useSession only to get the data stored with useState, and fetch the session on load the page through a plugin.

This follows the same approach of the auth module, which fetches the user on load the auth plugin.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions