From e01a06aaca4ee70f404a0a11fc55522a77288db4 Mon Sep 17 00:00:00 2001 From: limkhl Date: Fri, 24 May 2024 16:51:50 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=A7=80=EC=97=AD=EA=B5=AC=20=EB=82=98?= =?UTF-8?q?=EC=98=A4=EC=A7=80=20=EC=95=8A=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Result.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/Result.tsx b/src/components/Result.tsx index f695a32..2f77560 100644 --- a/src/components/Result.tsx +++ b/src/components/Result.tsx @@ -28,13 +28,14 @@ const Result = () => { async function joinPersonalInfo(candidates: any) { return Promise.all(candidates.map(async (candidate: any) => { - const { data: candidateInfo } = await client().get(`/api/candidates/${candidate.id}`) + const candidateInfo = await fetch(`/candidates/${candidate.id}.json`).then((res) => res.json()) + const { data: { elected } } = await client().get(`/api/candidates/${candidate.id}`) const { choice, id } = candidate - return { candidate: candidateInfo, choice, id } + return { candidate: candidateInfo, choice, id, elected } })) } - const electedAgrees = agrees.filter(e => e.candidate.elected) + const electedAgrees = agrees.filter(e => e.elected) React.useEffect(() => { fetchResponses()