docs: fix Update "Getting Session on a loader" example (#224)

In SvelteKit, you can only access the request object (like headers, cookies, etc.) in server-side contexts like +page.server.ts
This commit is contained in:
Krishna Santosh
2024-10-18 12:52:38 +03:00
committed by GitHub
parent 16887b8f00
commit de51d1c69b
@@ -69,10 +69,11 @@ Some of the actions are reactive. The client use [nano-store](https://github.com
### Example: Getting Session on a loader
```ts title="+page.ts"
```ts title="+page.server.ts"
import { auth } from "$lib/auth";
import type { PageServerLoad } from "./$types";
export async function load(request: Request) {
export const load: PageServerLoad = async ({request}) => {
const session = await auth.api.getSession({
headers: request.headers,
});