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

@ -18,17 +18,19 @@ export default function MetricsBar({ websiteId, token, className }) {
query: { url },
} = usePageQuery();
console.log({ modified });
const { data, error, loading } = useFetch(
`/api/website/${websiteId}/stats`,
{
start_at: +startDate,
end_at: +endDate,
url,
token,
},
{
update: [modified],
params: {
start_at: +startDate,
end_at: +endDate,
url,
token,
},
},
[modified],
);
const formatFunc = format ? formatLongNumber : formatNumber;