mirror of
https://github.com/umami-software/umami.git
synced 2026-02-05 05:07:15 +01:00
Added display of session properties.
This commit is contained in:
parent
3805a0b431
commit
0bd57bb158
10 changed files with 378 additions and 1 deletions
|
|
@ -10,6 +10,8 @@ export * from './queries/useReport';
|
|||
export * from './queries/useReports';
|
||||
export * from './queries/useSessionActivity';
|
||||
export * from './queries/useSessionData';
|
||||
export * from './queries/useSessionDataProperties';
|
||||
export * from './queries/useSessionDataValues';
|
||||
export * from './queries/useWebsiteSession';
|
||||
export * from './queries/useWebsiteSessions';
|
||||
export * from './queries/useShareToken';
|
||||
|
|
|
|||
20
src/components/hooks/queries/useSessionDataProperties.ts
Normal file
20
src/components/hooks/queries/useSessionDataProperties.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import useApi from './useApi';
|
||||
import { UseQueryOptions } from '@tanstack/react-query';
|
||||
import { useFilterParams } from '../useFilterParams';
|
||||
|
||||
export function useSessionDataProperties(
|
||||
websiteId: string,
|
||||
options?: Omit<UseQueryOptions, 'queryKey' | 'queryFn'>,
|
||||
) {
|
||||
const { get, useQuery } = useApi();
|
||||
const params = useFilterParams(websiteId);
|
||||
|
||||
return useQuery<any>({
|
||||
queryKey: ['websites:event-data:properties', { websiteId, ...params }],
|
||||
queryFn: () => get(`/websites/${websiteId}/session-data/properties`, { ...params }),
|
||||
enabled: !!websiteId,
|
||||
...options,
|
||||
});
|
||||
}
|
||||
|
||||
export default useSessionDataProperties;
|
||||
21
src/components/hooks/queries/useSessionDataValues.ts
Normal file
21
src/components/hooks/queries/useSessionDataValues.ts
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import useApi from './useApi';
|
||||
import { UseQueryOptions } from '@tanstack/react-query';
|
||||
import { useFilterParams } from '../useFilterParams';
|
||||
|
||||
export function useSessionDataValues(
|
||||
websiteId: string,
|
||||
propertyName: string,
|
||||
options?: Omit<UseQueryOptions, 'queryKey' | 'queryFn'>,
|
||||
) {
|
||||
const { get, useQuery } = useApi();
|
||||
const params = useFilterParams(websiteId);
|
||||
|
||||
return useQuery<any>({
|
||||
queryKey: ['websites:event-data:values', { websiteId, propertyName, ...params }],
|
||||
queryFn: () => get(`/websites/${websiteId}/session-data/values`, { ...params, propertyName }),
|
||||
enabled: !!(websiteId && propertyName),
|
||||
...options,
|
||||
});
|
||||
}
|
||||
|
||||
export default useSessionDataValues;
|
||||
Loading…
Add table
Add a link
Reference in a new issue