chore: rolls back next config testing

This commit is contained in:
James
2024-03-04 16:34:34 -05:00
parent f2239decca
commit 98aeff2f3e
2 changed files with 120 additions and 134 deletions

View File

@@ -3,9 +3,7 @@
import config from '@payload-config' import config from '@payload-config'
import { REST_DELETE, REST_GET, REST_PATCH, REST_POST } from '@payloadcms/next/routes' import { REST_DELETE, REST_GET, REST_PATCH, REST_POST } from '@payloadcms/next/routes'
export const GET = async (request: Request, options: { params: { slug: string[] } }) => { export const GET = REST_GET(config)
return REST_GET({ config, options, request })
}
export const POST = REST_POST(config) export const POST = REST_POST(config)
export const DELETE = REST_DELETE(config) export const DELETE = REST_DELETE(config)
export const PATCH = REST_PATCH(config) export const PATCH = REST_PATCH(config)

View File

@@ -146,23 +146,9 @@ const RouteNotFoundResponse = (slug: string[]) =>
{ status: httpStatus.NOT_FOUND }, { status: httpStatus.NOT_FOUND },
) )
type GetArgs = { export const GET =
config: Promise<SanitizedConfig> | SanitizedConfig (config: Promise<SanitizedConfig> | SanitizedConfig) =>
options: { async (request: Request, { params: { slug } }: { params: { slug: string[] } }) => {
params: {
slug: string[]
}
}
request: Request
}
export const GET = async ({
config,
options: {
params: { slug },
},
request,
}: GetArgs) => {
const [slug1, slug2, slug3, slug4] = slug const [slug1, slug2, slug3, slug4] = slug
let req: PayloadRequest let req: PayloadRequest
let res: Response let res: Response
@@ -262,7 +248,9 @@ export const GET = async ({
case 4: case 4:
if (`doc-${slug3}-by-id` in endpoints.global.GET) { if (`doc-${slug3}-by-id` in endpoints.global.GET) {
// /globals/:slug/versions/:id // /globals/:slug/versions/:id
res = await (endpoints.global.GET?.[`doc-${slug3}-by-id`] as GlobalRouteHandlerWithID)({ res = await (
endpoints.global.GET?.[`doc-${slug3}-by-id`] as GlobalRouteHandlerWithID
)({
id: slug4, id: slug4,
globalConfig, globalConfig,
req, req,
@@ -291,7 +279,7 @@ export const GET = async ({
req, req,
}) })
} }
} }
export const POST = export const POST =
(config: Promise<SanitizedConfig> | SanitizedConfig) => (config: Promise<SanitizedConfig> | SanitizedConfig) =>