Skip to content

In the session example code, should 'event.params.userId' be just 'userId'? #835

@johndunderhill

Description

@johndunderhill

📚 Subject area/topic

/solid-start/building-your-application/api-routes.mdx

📋 Page(s) affected (or suggested, for new content)

https://docs.solidjs.com/solid-start/building-your-application/api-routes#session-management

📋 Description of content that is out-of-date or incorrect

The narrative below the code example under Session management states 'you can see that the userId is read from the cookie and then used to look up the user in the store'. But that's not what I see here. I see that the userId is read from the cookie, and then checked if empty, generating an error if so. If it's not empty, then 'event.params.userId' (where does that come from?) is used to look up a user in a store and the IDs are compared. Seems like a different flow.

A subsequent example in the Session documentation (following the link below the narrtive) shows a getUser() function without a parameter that somehow locates appropriate session data and fishes a userId out of that. But this would require a session ID of some kind, which I don't see here. Unless that's SESSION_SECRET?? Where does it come from??

Is there any way this could be made a bit more clear, showing one step at a time what choices are available here, and what's required to use one of these approaches?

🖥️ Reproduction in StackBlitz (if reporting incorrect content or code samples)

No response

Metadata

Metadata

Assignees

Labels

in progressSomeone is currently working on the issue.solidstartRelated to SolidStart

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions