Skip to content

Commit

Permalink
fix: tvl & rowan price loading
Browse files Browse the repository at this point in the history
  • Loading branch information
alanrsoares committed Sep 15, 2022
1 parent 79d4681 commit 9ec3d2f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
10 changes: 4 additions & 6 deletions app/src/components/NavSidePanel/RowanPrice.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { computed, defineComponent } from "vue";
import { usePoolStats } from "@/hooks/usePoolStats";
import { defineComponent } from "vue";
import { useRowanPrice } from "@/hooks/useRowanPrice";

import NavSidePanelItem from "./NavSidePanelItem";

export default defineComponent({
name: "RowanPrice",
setup() {
const poolStats = usePoolStats();
const rowanPrice = computed(() => {
return poolStats.data.value?.rowanUsd;
});
const { data: rowanPrice } = useRowanPrice();

return () => (
<NavSidePanelItem
Expand Down
10 changes: 5 additions & 5 deletions app/src/hooks/useRowanPrice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import { watchEffect } from "vue";
import { useCore } from "@/hooks/useCore";
import { useAsyncDataCached } from "@/hooks/useAsyncDataCached";

function isNumeric(s: string): boolean {
return Number(s) - 0 === Number(s) && ("" + s).trim().length > 0;
}

export const useRowanPrice = (params?: { shouldReload: boolean }) => {
const { services } = useCore();

const price = useAsyncDataCached("rowanPrice", async () => {
function isNumeric(s: string): boolean {
return Number(s) - 0 === Number(s) && ("" + s).trim().length > 0;
}

const { body: stats } = await services.data.getTokenStats();
const stats = await services.data.getTokenStats();
const rowanPriceInUSDT = stats.rowanUSD ?? "";

if (isNumeric(rowanPriceInUSDT)) {
Expand Down
2 changes: 1 addition & 1 deletion app/src/hooks/useTVL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function useTVL() {
const loadTVL = async () => {
const tokenStats = await services.data.getTokenStats();

const pools = tokenStats.body.pools ?? [];
const pools = tokenStats.pools ?? [];

const total = pools.reduce(
(acc, { poolTVL, poolDepth }) =>
Expand Down

0 comments on commit 9ec3d2f

Please sign in to comment.