Before taking a user to the login screen, we should check if they're already logged in. With SvelteKit, you can use the `load` function to check if you're logged in before your app renders.

```js

```

By returning the account data in the root layout, it is globally available to all pages, **before any page is displayed** to the user. If we find the user is not logged in, we can redirect them to log in first.

We can get the returned data in the root page by using the `data` prop:

```svelte

```

Normally, you'll want to use the `invalidate` method instead of `invalidateAll`, to avoid fetching data that you don't need to. You can refer to the [SvelteKit docs](https://kit.svelte.dev/docs/modules#$app-navigation-invalidate) for more information on invalidation.
