chore!: simplify api handler (#6910)

Removes PayloadRequestWithData in favour of just PayloadRequest with
optional types for `data` and `locale`

`addDataAndFileToRequest` and `addLocalesToRequestFromData` now takes in
a single argument instead of an object

```ts
// before
await addDataAndFileToRequest({ request: req })
addLocalesToRequestFromData({ request: req })

// current
await addDataAndFileToRequest(req)
addLocalesToRequestFromData(req)
```

---------

Co-authored-by: Paul Popus <paul@nouance.io>
This commit is contained in:
Jarrod Flesch
2024-07-02 09:47:03 -04:00
committed by GitHub
parent fd7d500be1
commit 0711f880ff
231 changed files with 737 additions and 815 deletions

View File

@@ -1,3 +1,3 @@
import type { PayloadRequestWithData } from '../types/index.js'
import type { PayloadRequest } from '../types/index.js'
export default ({ req: { user } }: { req: PayloadRequestWithData }): boolean => Boolean(user)
export default ({ req: { user } }: { req: PayloadRequest }): boolean => Boolean(user)