add data request straking dashboard
This commit is contained in:
28
app/javascript/src/pages/Dashboard/Dashboard.tsx
Normal file
28
app/javascript/src/pages/Dashboard/Dashboard.tsx
Normal file
@@ -0,0 +1,28 @@
|
||||
import type { FC } from "react";
|
||||
import React from "react";
|
||||
import useSWR from "swr";
|
||||
|
||||
import { useCurrentUser } from "../../contexts/UserProvider";
|
||||
import type { YieldwatchResponse } from "../../types/yieldwatch";
|
||||
|
||||
export const Dashbaord: FC = () => {
|
||||
const { user } = useCurrentUser();
|
||||
|
||||
const { data } = useSWR<YieldwatchResponse>(
|
||||
`https://www.yieldwatch.net/api/all/${user?.walletAddress}?platforms=pancake`
|
||||
);
|
||||
|
||||
if (data?.status === "0" || !data) return null;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<ul>
|
||||
<li>Ganho: {data.result.PancakeSwap.staking.totalUSDValues.yield}</li>
|
||||
<li>
|
||||
Depositado: {data.result.PancakeSwap.staking.totalUSDValues.deposit}
|
||||
</li>
|
||||
<li>Total: {data.result.PancakeSwap.staking.totalUSDValues.total}</li>
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
1
app/javascript/src/pages/Dashboard/index.ts
Normal file
1
app/javascript/src/pages/Dashboard/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from "./Dashboard";
|
||||
@@ -1,3 +1,4 @@
|
||||
export * from "./Dashboard";
|
||||
export * from "./Home";
|
||||
export * from "./Wallet";
|
||||
export * from "./Orders";
|
||||
export * from "./Wallet";
|
||||
|
||||
Reference in New Issue
Block a user