5 Matching Annotations
- Jan 2022
-
stackoverflow.com stackoverflow.com
-
export const load: Load = async ({ page, session }) => { if (!isPublic(page.path) && !isAuthenticated(session)) { console.log('Unauthorized access to private page'); return { redirect: '/', status: 302 }; } else { console.log('Auth OK'); } return {}; };
-
- Oct 2021
-
kit.svelte.dev kit.svelte.dev
-
This function allows you to modify (or replace) a fetch request for an external resource that happens inside a load function that runs on the server (or during pre-rendering). For example, your load function might make a request to a public URL like https://api.yourapp.com when the user performs a client-side navigation to the respective page, but during SSR it might make sense to hit the API directly (bypassing whatever proxies and load balancers sit between it and the public internet).
-
- Jun 2021
-
github.com github.com
-
(load functions call handle directly, there's no intermediate network requests.)
-
-
kit.svelte.dev kit.svelte.dev
-
If you return a Promise from load, SvelteKit will delay rendering until the promise resolves.
-
should run on the same domain as any upstream API servers requiring credentials
-