mirror of
https://github.com/umami-software/umami.git
synced 2026-02-08 06:37:18 +01:00
add sessionstats query for performance, countries, events values
This commit is contained in:
parent
e98bc3bd74
commit
a058552d39
6 changed files with 220 additions and 36 deletions
16
src/components/hooks/queries/useWebsiteSessionStats.ts
Normal file
16
src/components/hooks/queries/useWebsiteSessionStats.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import { useApi } from './useApi';
|
||||
import { useFilterParams } from '../useFilterParams';
|
||||
|
||||
export function useWebsiteSessionStats(websiteId: string, options?: { [key: string]: string }) {
|
||||
const { get, useQuery } = useApi();
|
||||
const params = useFilterParams(websiteId);
|
||||
|
||||
return useQuery({
|
||||
queryKey: ['sessions:stats', { websiteId, ...params }],
|
||||
queryFn: () => get(`/websites/${websiteId}/sessions/stats`, { ...params }),
|
||||
enabled: !!websiteId,
|
||||
...options,
|
||||
});
|
||||
}
|
||||
|
||||
export default useWebsiteSessionStats;
|
||||
Loading…
Add table
Add a link
Reference in a new issue