You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1.2 KiB
1.2 KiB
The LoggedIn component checks if the user is logged in by doing a GET to "/api/login" and if that API endpoint returns 401 or 403 it will perform redirects for you. It updates the $user.authenticated
Svelte store (from client/stores.js
) and then as your app changes that setting it will adapt and display different content.
Use this component to:
- Block a page's content from unauthenticated users.
- Redirect users to your a new location if they are not authenticated.
- Show a standard redirect page when it's redirecting.
In this test you are simply changing the $user.authenticated to see how the LoggedIn component handles it dynamically. You should still add a check for $user.authenticated
in your own onMount
since svelte will run them no matter what.