Files
console-dev/app/lib/product-description-data.js
T
2026-11-06 00:04:38 +08:00

27 lines
597 B
JavaScript

async function e(e, t) {
if (typeof t.description == `string`) return t.description;
let n = Number(t.id);
if (!Number.isSafeInteger(n) || n <= 0) return ``;
try {
let t = await e.get(
`/product`,
{
product_ids: [n],
page: 1,
limit: 1,
},
!1,
{
timeoutMs: 5e3,
},
),
r = Array.isArray(t?.list)
? t.list.find((e) => e && Number(e.id) === n)
: void 0;
return typeof r?.description == `string` ? r.description : ``;
} catch {
return ``;
}
}
export { e as t };