Skip to content

Commit

Permalink
Update docs more, change API a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
apedroferreira committed Feb 8, 2024
1 parent ec1d7fe commit f2d4a65
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/data/toolpad/concepts/custom-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export async function getData() {
### Get the current authenticated user with `context.user`
If your Toolpad app has [authentication](/toolpad/concepts/authentication/) enabled, you can get data from the authenticated logged-in user, such as their `email`, `name` or `image`. Example:
If your Toolpad app has [authentication](/toolpad/concepts/authentication/) enabled, you can get data from the authenticated logged-in user, such as their `email`, `name` or `avatar`. Example:
```jsx
import { getContext } from '@mui/toolpad/server';
Expand Down
11 changes: 6 additions & 5 deletions docs/data/toolpad/reference/api/get-context.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ a `ServerContext` containing information on the context the backend function was
### ServerContext
This described a certain context under which a backend function was called.
This describes a certain context under which a backend function was called.
**Properties**
| Name | Type | Description |
| :---------- | :-------------------------------------- | :------------------------------------------------ |
| `cookies` | `Record<string, string>` | A dictionary mapping cookie name to cookie value. |
| `setCookie` | `(name: string, value: string) => void` | Use to set a cookie `name` with `value`. |
| Name | Type | Description |
| :---------- | :----------------------------------------------------------------- | :------------------------------------------------------------------------ |
| `cookies` | `Record<string, string>` | A dictionary mapping cookie name to cookie value. |
| `setCookie` | `(name: string, value: string) => void` | Use to set a cookie `name` with `value`. |
| `user` | `{ name: string; email: string; avatar: string; roles: string[] }` | Get current [authenticated](/toolpad/concepts/authentication/) user data. |
## Usage
Expand Down

0 comments on commit f2d4a65

Please sign in to comment.