-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
주식 정보 api와 보유주식 정보 api를 hook으로 호출 보유종목에서 위는 주식정보, 아래는 보유주식 정보를 출력 기업로고 대신 스톡홀름 로고로 대체 Issues #19
- Loading branch information
김병현
authored and
김병현
committed
Sep 15, 2023
1 parent
424b30b
commit 50f1a2d
Showing
6 changed files
with
205 additions
and
95 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { useQuery } from "react-query"; | ||
import axios from "axios"; | ||
|
||
const useGetStockHolds = () => { | ||
const { data, isLoading, error } = useQuery("stockHolds", getStockHolds, {}); | ||
|
||
return { stockHolds: data, stockHoldsLoading: isLoading, stockHoldsError: error }; | ||
}; | ||
|
||
export default useGetStockHolds; | ||
|
||
// 서버에서 StockHolds 목록 fetch 하는 함수 | ||
const getStockHolds = async () => { | ||
const token = localStorage.getItem('Authorization'); // 로컬 스토리지에서 토큰 가져오기 | ||
const res = await axios.get("http://ec2-13-125-246-160.ap-northeast-2.compute.amazonaws.com:8080/stock/stockholds", { | ||
headers: { | ||
'Authorization': token | ||
} | ||
}); | ||
const stockHoldsList = await res.data; | ||
|
||
return stockHoldsList; | ||
}; |