Skip to content

Commit

Permalink
[Fix]
Browse files Browse the repository at this point in the history
평가 수익금을 계산할 때 초깃값을 0으로 설정
Issues #19
  • Loading branch information
김병현 authored and 김병현 committed Sep 15, 2023
1 parent 76dd351 commit 0b45a87
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion client/src/components/HoldingList/HoldingList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ const HoldingList: React.FC<WatchListProps> = ({ 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 (
<WatchListContainer>
Expand Down
2 changes: 1 addition & 1 deletion client/src/hooks/useGetCash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
Expand Down

0 comments on commit 0b45a87

Please sign in to comment.