mirror of
https://github.com/umami-software/umami.git
synced 2026-02-06 21:57:16 +01:00
New goals page. Upgraded prisma.
This commit is contained in:
parent
99330a1a4d
commit
49bcbfd7f9
65 changed files with 769 additions and 1195 deletions
17
src/components/hooks/queries/useResultQuery.ts
Normal file
17
src/components/hooks/queries/useResultQuery.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import { useApi } from '@/components/hooks';
|
||||
import { UseQueryOptions, QueryKey } from '@tanstack/react-query';
|
||||
|
||||
export function useResultQuery<T>(
|
||||
type: string,
|
||||
params?: { [key: string]: any },
|
||||
options?: Omit<UseQueryOptions<T, Error, T, QueryKey>, 'queryKey' | 'queryFn'>,
|
||||
) {
|
||||
const { post, useQuery } = useApi();
|
||||
|
||||
return useQuery<T>({
|
||||
queryKey: ['reports', type, params],
|
||||
queryFn: () => post(`/reports/${type}`, params),
|
||||
enabled: !!type,
|
||||
...options,
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue