From 0b45a877acfa45edbbed80cd780b54bdd94728c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=B3=91=ED=98=84?= Date: Sat, 16 Sep 2023 04:56:45 +0900 Subject: [PATCH] =?UTF-8?q?[Fix]=20=ED=8F=89=EA=B0=80=20=EC=88=98=EC=9D=B5?= =?UTF-8?q?=EA=B8=88=EC=9D=84=20=EA=B3=84=EC=82=B0=ED=95=A0=20=EB=95=8C=20?= =?UTF-8?q?=EC=B4=88=EA=B9=83=EA=B0=92=EC=9D=84=200=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95=20Issues=20#19?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/components/HoldingList/HoldingList.tsx | 5 ++++- client/src/hooks/useGetCash.ts | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/client/src/components/HoldingList/HoldingList.tsx b/client/src/components/HoldingList/HoldingList.tsx index 80be8558..2facd2d3 100644 --- a/client/src/components/HoldingList/HoldingList.tsx +++ b/client/src/components/HoldingList/HoldingList.tsx @@ -14,8 +14,11 @@ const HoldingList: React.FC = ({ currentListType, onChangeListTy const { data: companyData, isLoading: isCompanyDataLoading, isError: isCompanyDataError } = useCompanyData(1, 14); // 모든 stockReturn의 합을 계산합니다. - const totalEvaluationProfit = stockHolds.reduce((sum: number, stockHold: StockItemProps['stockData']) => sum + stockHold.stockReturn, 0); + let totalEvaluationProfit = 0; + if (stockHolds) { + totalEvaluationProfit = stockHolds.reduce((sum:number, stockHold: StockItemProps['stockData']) => sum + stockHold.stockReturn, 0); + } return ( diff --git a/client/src/hooks/useGetCash.ts b/client/src/hooks/useGetCash.ts index 94ac9136..17bebf1d 100644 --- a/client/src/hooks/useGetCash.ts +++ b/client/src/hooks/useGetCash.ts @@ -19,7 +19,7 @@ const useGetCash = () => { export default useGetCash; const getCashData = async () => { - const token = localStorage.getItem("authToken"); + const token = localStorage.getItem("Authorization"); const options = { headers: { Authorization: `${token}`,