Skip to content

Commit

Permalink
Updates: new data point source
Browse files Browse the repository at this point in the history
  • Loading branch information
otobongfp committed Jun 3, 2024
1 parent df9a1c1 commit d92d9fa
Showing 1 changed file with 38 additions and 5 deletions.
43 changes: 38 additions & 5 deletions src/pages/overview/overviewTop.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,48 @@ const OverviewTop = () => {
fetchData();
}, []);

// useEffect(() => {
// const getData = async () => {
// try {
// const apyData = await getApy();
// setApy(apyData.toFixed(3) + "%");

// //const marketData = await MarketInfo.getMarketInfo();
// //Note MarketInfo.getMarketInfo exists here too to query marketData
// //You can alsways switch to it, we had issues with delay in using the
// //free coinGecko data sometimes, hence why there's a custom script

// const response = await axios.get(`${SCRIPT}/marketInfo`);
// const marketData = response.data;

// setCoinPrice(
// marketData?.geckoPrice
// ? marketData?.geckoPrice
// : marketData.binancePrice
// );
// setMarketCap(
// marketData?.geckoMarketCap
// ? marketData?.geckoMarketCap
// : marketData.estimatedMarketCap
// );
// } catch (error) {
// console.error("Error fetching data:", error);
// }
// };

// getData();
// }, []);

useEffect(() => {
const getData = async () => {
try {
const apyData = await getApy();
setApy(apyData.toFixed(3) + "%");

//const marketData = await MarketInfo.getMarketInfo();
//Note MarketInfo.getMarketInfo exists here too to query marketData
//You can alsways switch to it, we had issues with delay in using the
//free coinGecko data sometimes, hence why there's a custom script
// const marketData = await MarketInfo.getMarketInfo();
// Note MarketInfo.getMarketInfo exists here too to query marketData
// You can always switch to it, we had issues with delay in using the
// free coinGecko data sometimes, hence why there's a custom script

const response = await axios.get(`${SCRIPT}/marketInfo`);
const marketData = response.data;
Expand All @@ -91,8 +123,9 @@ const OverviewTop = () => {
console.error("Error fetching data:", error);
}
};

getData();
const intervalId = setInterval(getData, 15000);
return () => clearInterval(intervalId);
}, []);

const handleClick = (action) => {
Expand Down

0 comments on commit d92d9fa

Please sign in to comment.