Create a Svelte Store

Svelte store is used to secure the "/admin" page and to keep track of the currently signed-in user. Learn how to use the Svelte store for your web application.

To secure the /admin page and to keep track of the currently signed-in user, we are going to create a Svelte store. As soon as a user signs in, we set the user information in the store. When a user signs out, we remove the user information.

This store can then be used anywhere in the web application. For example, we will also use it to display “Sign In” vs. “Sign out” in the navigation bar, depending on whether a user is signed in or not.

Creating a Svelte store to keep track of the current

...