Files
klz-cables.com/.pnpm-store/v10/files/bf/cf56de65030d6420ece7fc9663ed2e50c7a8a38a9009b0b312803998ef738ee1f5d32fd0c2c9d00bebee79f19bcfc934d593018ad25b63205f943b9583199e
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.0 KiB
Plaintext

import { status as httpStatus } from 'http-status';
import { findOne } from '../operations/findOne.js';
export const findByIDHandler = async (incomingReq)=>{
// We cannot import the addDataAndFileToRequest utility here from the 'next' package because of dependency issues
// However that utility should be used where possible instead of manually appending the data
let data;
try {
data = await incomingReq.json?.();
} catch (ignore) {
data = {};
}
const reqWithData = incomingReq;
if (data) {
reqWithData.data = data;
// @ts-expect-error
reqWithData.json = ()=>Promise.resolve(data);
}
const result = await findOne({
key: reqWithData.routeParams?.key,
req: reqWithData,
user: reqWithData.user
});
return Response.json({
...result ? result : {
message: reqWithData.t('general:notFound'),
value: null
}
}, {
status: httpStatus.OK
});
};
//# sourceMappingURL=findOne.js.map