Logo

Sierra-95/svelte-scaffold

User Store

User Store

This store is used by most components to manage user-related data including the UserMenu component

svelte
Loading...

$User.userId

On mount, the application checks whether local storage contains a anonymous_id. If it exists, the User store is updated with this value.

If it doesn't exist and your not logged in (isLoggedIn is false), a new user id is generated using crypto.randomUUID(). The User store and local storage is then updated with the newly created value.

If you're logged in, manually update $User.userId accordingly.

Compulsory $User.userId?

Here are some modules that rely on $User.userId