docs(hooks): add returned and responseHeaders properties

This commit is contained in:
Bereket Engida
2025-03-04 10:49:38 +03:00
parent 827429653c
commit 227df06374

View File

@@ -184,6 +184,26 @@ createAuthMiddleware(async (ctx) => {
});
```
#### Returned
The returned value from the hook is passed to the next hook in the chain.
```ts title="auth.ts"
createAuthMiddleware(async (ctx) => {
const returned = ctx.context.returned; //this could be a successful response or an APIError
});
```
#### Response Headers
The response headers added by endpoints and hooks that run before this hook.
```ts title="auth.ts"
createAuthMiddleware(async (ctx) => {
const responseHeaders = ctx.context.responseHeaders;
});
```
#### Predefined Auth Cookies
Access BetterAuths predefined cookie properties: