Skip to content

session utils don't mention anything about the name in the config #969

Open
@datner

Description

@datner

Describe the change

I don't mean that it accepts a name, but rather that the implementation is built in such a way to support multiple sessions at the same time

const session = await useSession(event, { name: 'foo', ..})
const session2 = await useSession(event, { name: 'bar, ..})

session.id !== session2

This is very useful for holding different references for different things without bloating the very very restrictive space a cookie can hold.
Most commonly, this can be used for flashing data. Something I had to enhance my unstorage driver layers can be done for free. It's a shame really..

Is there a reason for that? If so, is there a reason why it is a map at all?

URLs

https://h3.unjs.io/examples/handle-session

https://h3.unjs.io/utils/advanced#session-utils

Additional information

  • Would you be willing to help?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions