Files
klz-cables.com/.pnpm-store/v10/files/10/283a0162b47f89d91911e60f148d7edac75fe246307c67e44fc27e5a2bad98f7c53781f5d1c805487c8282ac69b9045308a5e3397c860cd7764906412110d0
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

36 lines
1.2 KiB
Plaintext

import { getTranslation } from '@payloadcms/translations';
import { status as httpStatus } from 'http-status';
import { getRequestCollectionWithID } from '../../utilities/getRequestEntity.js';
import { headersWithCors } from '../../utilities/headersWithCors.js';
import { parseParams } from '../../utilities/parseParams/index.js';
import { duplicateOperation } from '../operations/duplicate.js';
export const duplicateHandler = async (req)=>{
const { id, collection } = getRequestCollectionWithID(req);
const { depth, draft, populate, select, selectedLocales } = parseParams(req.query);
const doc = await duplicateOperation({
id,
collection,
data: req.data,
depth,
draft,
populate,
req,
select,
selectedLocales
});
const message = req.t('general:successfullyDuplicated', {
label: getTranslation(collection.config.labels.singular, req.i18n)
});
return Response.json({
doc,
message
}, {
headers: headersWithCors({
headers: new Headers(),
req
}),
status: httpStatus.OK
});
};
//# sourceMappingURL=duplicate.js.map