From cc45c239155834855db602dc88e9f5d6c123ec49 Mon Sep 17 00:00:00 2001 From: Oliver Date: Fri, 30 Aug 2024 10:38:48 +1000 Subject: [PATCH] Fix return type of detail queries (#8038) --- src/frontend/src/pages/part/PartDetail.tsx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/frontend/src/pages/part/PartDetail.tsx b/src/frontend/src/pages/part/PartDetail.tsx index aec379ac31..fb4763b54d 100644 --- a/src/frontend/src/pages/part/PartDetail.tsx +++ b/src/frontend/src/pages/part/PartDetail.tsx @@ -403,17 +403,17 @@ export default function PartDetail() { case 200: return response.data; default: - return null; + return {}; } }) .catch(() => { - return null; + return {}; }); } }); return ( - data && + data.overall_min && `${formatPriceRange(data.overall_min, data.overall_max)}${ part.units && ' / ' + part.units }` @@ -443,19 +443,19 @@ export default function PartDetail() { if (response.data.length > 0) { return response.data[response.data.length - 1]; } else { - return null; + return {}; } default: - return null; + return {}; } }) .catch(() => { - return null; + return {}; }); } }); - if (data.quantity) { + if (data && data.quantity) { return `${data.quantity} (${data.date})`; } else { return '-'; @@ -482,11 +482,11 @@ export default function PartDetail() { case 200: return response.data[response.data.length - 1]; default: - return null; + return {}; } }) .catch(() => { - return null; + return {}; }); } });