Skip to content

Commit

Permalink
Include SSR instructions in the README, fixes atinux#97
Browse files Browse the repository at this point in the history
  • Loading branch information
raggesilver committed Jun 10, 2024
1 parent c323edc commit 8ab0989
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,17 @@ export default defineNitroPlugin(() => {
})
```

## Server-Side Rendering

You can make authenticated requests both from the client and the server. However, you must use `useRequestFetch()` to make authenticated requests during SSR.

```ts
// In your script setup
const { data } = await useRequestFetch()('/api/protected-endpoint');
```

> There's [an open issue](https://github.com/nuxt/nuxt/issues/24813) to include credentials in `$fetch`/`useFetch` in Nuxt.
## Configuration

We leverage `runtimeConfig.session` to give the defaults option to [h3 `useSession`](https://h3.unjs.io/examples/handle-session).
Expand Down

0 comments on commit 8ab0989

Please sign in to comment.