fix: me route
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
|
||||
/* DO NOT MODIFY it because it could be re-written at any time. */
|
||||
import { login } from '@payloadcms/next/routes/login'
|
||||
import config from 'payload-config'
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
|
||||
/* DO NOT MODIFY it because it could be re-written at any time. */
|
||||
import { me } from '@payloadcms/next/routes/me'
|
||||
import { NextRequest, NextResponse } from 'next/server'
|
||||
import config from 'payload-config'
|
||||
|
||||
export const GET = async (req: NextRequest, res: NextResponse, params: { collection: string }) =>
|
||||
me({ config, req, res, params })
|
||||
export const GET = me({ config })
|
||||
|
||||
@@ -115,7 +115,7 @@ export const createPayloadRequest = async ({
|
||||
|
||||
const req: PayloadRequest = Object.assign(request, customRequest)
|
||||
|
||||
req.user = getAuthenticatedUser({
|
||||
req.user = await getAuthenticatedUser({
|
||||
payload,
|
||||
headers: req.headers,
|
||||
isGraphQL,
|
||||
|
||||
@@ -4,14 +4,12 @@ import { createPayloadRequest } from '../createPayloadRequest'
|
||||
|
||||
export const me = ({ config }: { config: Promise<SanitizedConfig> }) =>
|
||||
async function (request: Request, { params }: { params: { collection: string } }) {
|
||||
console.log('b4 ME')
|
||||
const req = await createPayloadRequest({ request, config })
|
||||
const collection = req.payload.collections[params.collection]
|
||||
const meRes = await meOperation({
|
||||
collection,
|
||||
req,
|
||||
})
|
||||
console.log('meRes', meRes)
|
||||
|
||||
return Response.json(meRes)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user