pagamio-frontend-commons-lib
Version:
Pagamio library for Frontend reusable components like the form engine and table container
16 lines (15 loc) • 690 B
TypeScript
import type { QueryProps } from '../../shared/types';
import type { MetricData } from '../types';
/**
* Hook for fetching chart data with optimized caching to reduce server load
* @template T The data type to be returned from the API
* @template TransformReturnType The type after transformation
*/
export declare const useChartData: <T = MetricData[], TransformReturnType = T>(url: string, query: QueryProps, transform?: (data: T) => TransformReturnType) => {
data: T | TransformReturnType | undefined;
error: import("../../api").ApiErrorResponse | undefined;
loading: boolean;
isEmpty: boolean;
refresh: () => Promise<any>;
lastRefreshed: Date | undefined;
};