mars-v2-frontend/src/components/FetchPrices.tsx

16 lines
288 B
TypeScript
Raw Normal View History

'use client'
import useSWR from 'swr'
import useStore from 'store'
import { getPrices } from 'utils/api'
export default function FetchPrices() {
useSWR('prices', getPrices, {
refreshInterval: 30000,
onSuccess: (prices) => useStore.setState({ prices }),
})
return null
}