Fixed retention report showing wrong dates. Changed Breakdown field select to modal.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { useApi } from '@/components/hooks';
|
||||
import { useApi } from '../useApi';
|
||||
import { useFilterParams } from '../useFilterParams';
|
||||
import { ReactQueryOptions } from '@/lib/types';
|
||||
|
||||
export function useResultQuery<T>(
|
||||
@@ -6,11 +7,21 @@ export function useResultQuery<T>(
|
||||
params?: { [key: string]: any },
|
||||
options?: ReactQueryOptions<T>,
|
||||
) {
|
||||
const { websiteId } = params;
|
||||
const { post, useQuery } = useApi();
|
||||
const filterParams = useFilterParams(websiteId);
|
||||
|
||||
return useQuery<T>({
|
||||
queryKey: ['reports', type, params],
|
||||
queryFn: () => post(`/reports/${type}`, { type, ...params }),
|
||||
queryKey: [
|
||||
'reports',
|
||||
{
|
||||
type,
|
||||
websiteId,
|
||||
...filterParams,
|
||||
...params,
|
||||
},
|
||||
],
|
||||
queryFn: () => post(`/reports/${type}`, { type, ...filterParams, ...params }),
|
||||
enabled: !!type,
|
||||
...options,
|
||||
});
|
||||
|
||||
@@ -11,7 +11,7 @@ export type WebsiteMetricsData = {
|
||||
|
||||
export function useWebsiteMetricsQuery(
|
||||
websiteId: string,
|
||||
queryParams: { type: string; limit?: number; search?: string; startAt?: number; endAt?: number },
|
||||
params: { type: string; limit?: number; search?: string; startAt?: number; endAt?: number },
|
||||
options?: ReactQueryOptions<WebsiteMetricsData>,
|
||||
) {
|
||||
const { get, useQuery } = useApi();
|
||||
@@ -24,14 +24,14 @@ export function useWebsiteMetricsQuery(
|
||||
{
|
||||
websiteId,
|
||||
...filterParams,
|
||||
...queryParams,
|
||||
...params,
|
||||
},
|
||||
],
|
||||
queryFn: async () =>
|
||||
get(`/websites/${websiteId}/metrics`, {
|
||||
...filterParams,
|
||||
[searchParams.get('view')]: undefined,
|
||||
...queryParams,
|
||||
...params,
|
||||
}),
|
||||
enabled: !!websiteId,
|
||||
placeholderData: keepPreviousData,
|
||||
|
||||
Reference in New Issue
Block a user