mirror of
https://github.com/SigNoz/signoz.git
synced 2025-12-18 16:07:10 +00:00
19 lines
772 B
TypeScript
19 lines
772 B
TypeScript
|
|
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
|
||
|
|
import { useQuery, UseQueryOptions, UseQueryResult } from 'react-query';
|
||
|
|
import {
|
||
|
|
GetMetricQueryRange,
|
||
|
|
GetQueryResultsProps,
|
||
|
|
} from 'store/actions/dashboard/getQueryResults';
|
||
|
|
import { SuccessResponse } from 'types/api';
|
||
|
|
import { MetricRangePayloadProps } from 'types/api/metrics/getQueryRange';
|
||
|
|
|
||
|
|
export const useGetQueryRange = (
|
||
|
|
requestData: GetQueryResultsProps,
|
||
|
|
options?: UseQueryOptions<SuccessResponse<MetricRangePayloadProps>, Error>,
|
||
|
|
): UseQueryResult<SuccessResponse<MetricRangePayloadProps>, Error> =>
|
||
|
|
useQuery<SuccessResponse<MetricRangePayloadProps>, Error>({
|
||
|
|
queryKey: [REACT_QUERY_KEY.GET_QUERY_RANGE, requestData],
|
||
|
|
queryFn: async () => GetMetricQueryRange(requestData),
|
||
|
|
...options,
|
||
|
|
});
|