From cabc5280cd754d9eb85888db0acc6de2ed820da2 Mon Sep 17 00:00:00 2001 From: MinJ <ussr1285@ajou.ac.kr> Date: Sun, 8 Dec 2024 01:00:14 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20partids=EC=99=80=20partIds=20=EB=B6=84?= =?UTF-8?q?=EA=B8=B0=20(=EC=9E=84=EC=8B=9C)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/CombinationBox.jsx | 43 +++++++++++++------ 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/src/pages/SearchCombinationPage/components/CombinationBox.jsx b/src/pages/SearchCombinationPage/components/CombinationBox.jsx index 0f4fabb..3a5947b 100644 --- a/src/pages/SearchCombinationPage/components/CombinationBox.jsx +++ b/src/pages/SearchCombinationPage/components/CombinationBox.jsx @@ -9,19 +9,36 @@ const CombinationBox = ({ title, combination }) => { const fetchPartDetails = async () => { try { const details = await Promise.all( - combination.partIds.map(async (partId) => { - const partData = await getPartById(partId); - return { - image: partData.image_url, - title: partData.name, - partType: partData.type, - description: partData.description - .split('/') - .map(item => item.trim()) - .filter(item => item !== '') - .join(' / '), - }; - }) + (combination.partids?( + combination.partids.map(async (partId) => { + const partData = await getPartById(partId); + return { + image: partData.image_url, + title: partData.name, + partType: partData.type, + description: partData.description + .split('/') + .map(item => item.trim()) + .filter(item => item !== '') + .join(' / '), + }; + }) + ):( + combination.partIds.map(async (partId) => { + const partData = await getPartById(partId); + return { + image: partData.image_url, + title: partData.name, + partType: partData.type, + description: partData.description + .split('/') + .map(item => item.trim()) + .filter(item => item !== '') + .join(' / '), + }; + }) + ) + ) ); setPartDetails(details); } catch (error) { -- GitLab