mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +01:00
Renamed query hooks. Fixed conversion bugs.
This commit is contained in:
parent
adca3c36d0
commit
7886c3f393
110 changed files with 423 additions and 489 deletions
18
src/components/hooks/queries/useWebsiteStatsQuery.ts
Normal file
18
src/components/hooks/queries/useWebsiteStatsQuery.ts
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import { useApi } from '../useApi';
|
||||
import { useFilterParams } from '../useFilterParams';
|
||||
|
||||
export function useWebsiteStatsQuery(
|
||||
websiteId: string,
|
||||
compare?: string,
|
||||
options?: { [key: string]: string },
|
||||
) {
|
||||
const { get, useQuery } = useApi();
|
||||
const params = useFilterParams(websiteId);
|
||||
|
||||
return useQuery({
|
||||
queryKey: ['websites:stats', { websiteId, ...params, compare }],
|
||||
queryFn: () => get(`/websites/${websiteId}/stats`, { ...params, compare }),
|
||||
enabled: !!websiteId,
|
||||
...options,
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue