mirror of
https://github.com/umami-software/umami.git
synced 2026-02-10 07:37:11 +01:00
Refactored useQuery functions.
This commit is contained in:
parent
be550cc440
commit
b578162cb6
33 changed files with 179 additions and 151 deletions
|
|
@ -35,8 +35,8 @@ export function MetricsTable({
|
|||
const { get, useQuery } = useApi();
|
||||
const { dir } = useLocale();
|
||||
|
||||
const { data, isLoading, isFetched, error } = useQuery(
|
||||
[
|
||||
const { data, isLoading, isFetched, error } = useQuery({
|
||||
queryKey: [
|
||||
'websites:metrics',
|
||||
{
|
||||
websiteId,
|
||||
|
|
@ -53,11 +53,13 @@ export function MetricsTable({
|
|||
city,
|
||||
},
|
||||
],
|
||||
() => {
|
||||
queryFn: () => {
|
||||
const filters = { url, title, referrer, os, browser, device, country, region, city };
|
||||
|
||||
filters[type] = undefined;
|
||||
|
||||
onDataLoad?.();
|
||||
|
||||
return get(`/websites/${websiteId}/metrics`, {
|
||||
type,
|
||||
startAt: +startDate,
|
||||
|
|
@ -65,8 +67,8 @@ export function MetricsTable({
|
|||
...filters,
|
||||
});
|
||||
},
|
||||
{ onSuccess: onDataLoad, retryDelay: delay || DEFAULT_ANIMATION_DURATION },
|
||||
);
|
||||
retryDelay: delay || DEFAULT_ANIMATION_DURATION,
|
||||
});
|
||||
|
||||
const filteredData = useMemo(() => {
|
||||
if (data) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue