mirror of
https://github.com/umami-software/umami.git
synced 2026-02-07 14:17:13 +01:00
Updated events/sessions pages. Added DateDistance component.
This commit is contained in:
parent
8b64029409
commit
5b300f1ff5
13 changed files with 44 additions and 35 deletions
|
|
@ -2,7 +2,7 @@ import { useApi } from '../useApi';
|
|||
import { useFilterParams } from '../useFilterParams';
|
||||
import { ReactQueryOptions } from '@/lib/types';
|
||||
|
||||
export function useResultQuery<T>(
|
||||
export function useResultQuery<T = any>(
|
||||
type: string,
|
||||
params?: { [key: string]: any },
|
||||
options?: ReactQueryOptions<T>,
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
import { useApi } from '../useApi';
|
||||
import { usePagedQuery } from '../usePagedQuery';
|
||||
import { useModified } from '../useModified';
|
||||
|
||||
export function useTeamsQuery(userId: string) {
|
||||
const { get } = useApi();
|
||||
const { get, useQuery } = useApi();
|
||||
const { modified } = useModified(`teams`);
|
||||
|
||||
return usePagedQuery({
|
||||
return useQuery({
|
||||
queryKey: ['teams', { userId, modified }],
|
||||
queryFn: (params: any) => {
|
||||
return get(`/users/${userId}/teams`, params);
|
||||
|
|
|
|||
|
|
@ -5,12 +5,11 @@ import { ReactQueryOptions } from '@/lib/types';
|
|||
|
||||
export function useWebsiteEventsQuery(websiteId: string, options?: ReactQueryOptions<any>) {
|
||||
const { get } = useApi();
|
||||
const params = useFilterParams(websiteId);
|
||||
const filterParams = useFilterParams(websiteId);
|
||||
|
||||
return usePagedQuery({
|
||||
queryKey: ['websites:events', { websiteId, ...params }],
|
||||
queryFn: pageParams =>
|
||||
get(`/websites/${websiteId}/events`, { ...params, ...pageParams, pageSize: 20 }),
|
||||
queryKey: ['websites:events', { websiteId, ...filterParams }],
|
||||
queryFn: () => get(`/websites/${websiteId}/events`, { ...filterParams, pageSize: 20 }),
|
||||
enabled: !!websiteId,
|
||||
...options,
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue