Files
klz-cables.com/.pnpm-store/v10/files/b1/4c82b10ec0b1fab6806c3a5eb126284001cc63113fc81083035c515ec03d4093e5657ab89942c7c8fe8e0dbbc6aeba072d4baf2124dac1241f063d183a771e
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

32 lines
1.0 KiB
Plaintext

import { status as httpStatus } from 'http-status';
import { update } from '../operations/update.js';
export const updateHandler = 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 (_err) {
data = {};
}
const reqWithData = incomingReq;
if (data) {
reqWithData.data = data;
// @ts-expect-error
reqWithData.json = ()=>Promise.resolve(data);
}
const doc = await update({
key: reqWithData.routeParams?.key,
req: reqWithData,
user: reqWithData?.user,
value: reqWithData.data?.value || reqWithData.data
});
return Response.json({
doc,
message: reqWithData.t('general:updatedSuccessfully')
}, {
status: httpStatus.OK
});
};
//# sourceMappingURL=update.js.map