Files
klz-cables.com/.pnpm-store/v10/files/99/fbaa1216a946de3f370a42983016dba425dedc9a608fd8e5098a834619a227d7a90ffb822f5749180edb74de713fde482ed01b5646acb86d9011a798b87e2b
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

33 lines
1.1 KiB
Plaintext

import { handleEndpoints } from 'payload';
import { formatAdminURL } from 'payload/shared';
import { generateOGImage } from './og/index.js';
let initedOGEndpoint = false;
const handlerBuilder = config => async (request, args) => {
const awaitedConfig = await config;
// Add this endpoint only when using Next.js, still can be overridden.
if (initedOGEndpoint === false && !awaitedConfig.endpoints.some(endpoint => endpoint.path === '/og' && endpoint.method === 'get')) {
awaitedConfig.endpoints.push({
handler: generateOGImage,
method: 'get',
path: '/og'
});
}
initedOGEndpoint = true;
const awaitedParams = await args.params;
const response = await handleEndpoints({
config,
path: formatAdminURL({
apiRoute: awaitedConfig.routes.api,
path: awaitedParams ? `/${awaitedParams.slug.join('/')}` : undefined
}),
request
});
return response;
};
export const OPTIONS = handlerBuilder;
export const GET = handlerBuilder;
export const POST = handlerBuilder;
export const DELETE = handlerBuilder;
export const PATCH = handlerBuilder;
export const PUT = handlerBuilder;
//# sourceMappingURL=index.js.map