More work on reports. Added Funnel page.
This commit is contained in:
@@ -2,14 +2,13 @@ import { useApi } from '../useApi';
|
||||
import { usePagedQuery } from '../usePagedQuery';
|
||||
import { useModified } from '../useModified';
|
||||
|
||||
export function useReportsQuery({ websiteId, teamId }: { websiteId?: string; teamId?: string }) {
|
||||
const { modified } = useModified(`reports`);
|
||||
export function useReportsQuery({ websiteId, type }: { websiteId: string; type?: string }) {
|
||||
const { modified } = useModified(`reports:${type}`);
|
||||
const { get } = useApi();
|
||||
|
||||
return usePagedQuery({
|
||||
queryKey: ['reports', { websiteId, teamId, modified }],
|
||||
queryFn: (params: any) => {
|
||||
return get('/reports', { websiteId, teamId, ...params });
|
||||
},
|
||||
queryKey: ['reports', { websiteId, type, modified }],
|
||||
queryFn: async () => get('/reports', { websiteId, type }),
|
||||
enabled: !!websiteId && !!type,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user