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 282a2a5 commit df9a1c1
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/pages/overview/overviewTop.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
useTheme,
} from "@mui/material";
import axios from "axios";
import { BASE_URL, STATS } from "../../utils/config";
import { BASE_URL, STATS, SCRIPT } from "../../utils/config";
import { getApy, getGenerators, getNodeNumber, MarketInfo } from "../../utils";
import Loader from "../../components/global/Loader";

Expand All @@ -28,7 +28,7 @@ const OverviewTop = () => {
const [marketCap, setMarketCap] = useState(null);

useEffect(() => {
const timer = setTimeout(() => setLoading(false), 6000);
const timer = setTimeout(() => setLoading(false), 4000);
return () => clearTimeout(timer);
}, []);

Expand All @@ -38,7 +38,6 @@ const OverviewTop = () => {
const supplyResponse = await axios.get(
`${STATS}/stats/supply/circulating`
);

setSupply(supplyResponse.data);
} catch (error) {
console.error("Error fetching data:", error);
Expand Down Expand Up @@ -70,7 +69,13 @@ const OverviewTop = () => {
const apyData = await getApy();
setApy(apyData.toFixed(3) + "%");

const marketData = await MarketInfo.getMarketInfo();
//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
Expand Down

0 comments on commit df9a1c1

Please sign in to comment.