feat: adds req to filterOptions args (#10204)
Adds `req` to `filterOptions` arguments.
This commit is contained in:
@@ -156,6 +156,7 @@ called with an argument object with the following properties:
|
||||
| `siblingData` | An object containing document data that is scoped to only fields within the same parent of this field |
|
||||
| `id` | The `id` of the current document being edited. `id` is `undefined` during the `create` operation |
|
||||
| `user` | An object containing the currently authenticated user |
|
||||
| `req` | The Payload Request, which contains references to `payload`, `user`, `locale`, and more. |
|
||||
|
||||
## Example
|
||||
|
||||
|
||||
@@ -108,6 +108,7 @@ called with an argument object with the following properties:
|
||||
| `siblingData` | An object containing document data that is scoped to only fields within the same parent of this field |
|
||||
| `id` | The `id` of the current document being edited. `id` is `undefined` during the `create` operation |
|
||||
| `user` | An object containing the currently authenticated user |
|
||||
| `req` | The Payload Request, which contains references to `payload`, `user`, `locale`, and more. |
|
||||
|
||||
### Example#filter-options-example
|
||||
|
||||
|
||||
@@ -243,6 +243,7 @@ export type FilterOptionsProps<TData = any> = {
|
||||
* The collection `slug` to filter against, limited to this field's `relationTo` property.
|
||||
*/
|
||||
relationTo: CollectionSlug
|
||||
req: PayloadRequest
|
||||
/**
|
||||
* An object containing document data that is scoped to only fields within the same parent of this field.
|
||||
*/
|
||||
|
||||
@@ -525,6 +525,7 @@ const validateFilterOptions: Validate<
|
||||
id,
|
||||
data,
|
||||
relationTo: collection,
|
||||
req,
|
||||
siblingData,
|
||||
user,
|
||||
})
|
||||
|
||||
@@ -532,6 +532,7 @@ export const addFieldStatePromise = async (args: AddFieldStatePromiseArgs): Prom
|
||||
id,
|
||||
data: fullData,
|
||||
relationTo: field.relationTo,
|
||||
req,
|
||||
siblingData: data,
|
||||
user: req.user,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user