Skip to content

Commit

Permalink
chore(website): fix typo in standalone middleware section
Browse files Browse the repository at this point in the history
  • Loading branch information
TheEdoRan committed Oct 21, 2024
1 parent f8519cc commit 52d3d29
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion website/docs/define-actions/middleware.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,4 +265,4 @@ export const actionClientWithMyMiddleware = actionClient.use(myMiddleware1).use(

An action defined using the `actionClientWithMyMiddleware` will contain `foo`, `baz` and `john` in its context.

\* Note that you can pass, **but not required to**, an object with two generic properties to the `createMiddleware()` function: `ctx` \[1\], `metadata` \[2\] and `serverError` \[3\]. Those keys are optional, and you should only provide them if you want your middleware to require **at minimum** the shape you passed in as generic. By doing that, following the above example, you can then access `ctx.foo` and `metadata.actionName` in the middleware you're defining, and by awaiting the `next` function you'll see that `serverError` is an object with the `message` property. If you pass a middleware that requires those properties to a client that doesn't have them, you'll get an error in `use()` method.
\* Note that you can pass, **but not required to**, an object with three generic properties to the `createMiddleware()` function: `ctx` \[1\], `metadata` \[2\] and `serverError` \[3\]. Those keys are optional, and you should only provide them if you want your middleware to require **at minimum** the shape you passed in as generic. By doing that, following the above example, you can then access `ctx.foo` and `metadata.actionName` in the middleware you're defining, and by awaiting the `next` function you'll see that `serverError` is an object with the `message` property. If you pass a middleware that requires those properties to a client that doesn't have them, you'll get an error in `use()` method.

0 comments on commit 52d3d29

Please sign in to comment.