mirror of
https://github.com/umami-software/umami.git
synced 2025-12-06 01:18:00 +01:00
20 lines
544 B
TypeScript
20 lines
544 B
TypeScript
import { useApi } from '../useApi';
|
|
import { useFilterParams } from '../useFilterParams';
|
|
|
|
export function useWebsiteStats(
|
|
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,
|
|
});
|
|
}
|
|
|
|
export default useWebsiteStats;
|