From f2d4a6560127c82660b1b28ca8c4fcfcf8b90a51 Mon Sep 17 00:00:00 2001 From: Pedro Ferreira <10789765+apedroferreira@users.noreply.github.com> Date: Thu, 8 Feb 2024 17:53:31 +0000 Subject: [PATCH] Update docs more, change API a bit --- docs/data/toolpad/concepts/custom-functions.md | 2 +- docs/data/toolpad/reference/api/get-context.md | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/data/toolpad/concepts/custom-functions.md b/docs/data/toolpad/concepts/custom-functions.md index 15b9e99e255..98c8219f773 100644 --- a/docs/data/toolpad/concepts/custom-functions.md +++ b/docs/data/toolpad/concepts/custom-functions.md @@ -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'; diff --git a/docs/data/toolpad/reference/api/get-context.md b/docs/data/toolpad/reference/api/get-context.md index 19dfcd53bd3..abbe8e046bc 100644 --- a/docs/data/toolpad/reference/api/get-context.md +++ b/docs/data/toolpad/reference/api/get-context.md @@ -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` | 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` | 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