16 lines
288 B
TypeScript
16 lines
288 B
TypeScript
|
'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
|
||
|
}
|