Skip to content

Commit

Permalink
refactor usestakedaoyield
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitalsine85 committed Aug 1, 2023
1 parent 8460c65 commit 68f7b5a
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/hooks/gauges/useStakeDaoYield.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import { useEffect, useState } from 'react'

interface YieldData {
apr?: number
tvl?: number
}

export const useStakeDaoYield = () => {
const [apr, setApr] = useState(null)
const [tvl, setTvl] = useState(null)
const [apr, setApr] = useState<number | undefined>()
const [tvl, setTvl] = useState<number | undefined>()

useEffect(() => {
fetch('/api/yield/stakedao')
.then(response => response.json())
.then(data => {
const apr = data.apr
.then((data: YieldData) => {
const { apr, tvl } = data
setApr(apr)
const tvl = data.tvl
setTvl(tvl)
})
.catch(error => {
Expand Down

0 comments on commit 68f7b5a

Please sign in to comment.