Skip to content

Commit

Permalink
chore: adds testing endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
jmikrut committed Apr 5, 2023
1 parent 8f6bc5c commit c91da06
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pages/api/[collection]/me-test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import meOperation from 'payload/dist/auth/operations/me'
import withPayload from '@payloadcms/next-payload/middleware/withPayload'
import withDataLoader from '@payloadcms/next-payload/middleware/dataLoader'

async function handler(req, res) {
const collection = req.payload.collections[req.query.collection]
const result = await meOperation({ req, collection })
return res.status(200).json(result)
}

export default withPayload(
withDataLoader(
handler
)
)

0 comments on commit c91da06

Please sign in to comment.