Updated fetch hook API.

This commit is contained in:
Mike Cao 2020-10-09 12:39:03 -07:00
commit 69b317386a
21 changed files with 112 additions and 76 deletions

View file

@ -40,14 +40,18 @@ export default function MetricsTable({
const { data, loading, error } = useFetch(
`/api/website/${websiteId}/metrics`,
{
type,
start_at: +startDate,
end_at: +endDate,
domain: websiteDomain,
url,
token,
params: {
type,
start_at: +startDate,
end_at: +endDate,
domain: websiteDomain,
url,
token,
},
onDataLoad,
delay: 300,
},
{ onDataLoad, delay: 300, update: [modified] },
[modified],
);
const [format, setFormat] = useState(true);
const formatFunc = format ? formatLongNumber : formatNumber;