15 lines
511 B
TypeScript
15 lines
511 B
TypeScript
import { useQuery } from '@tanstack/react-query';
|
|
import { getBondCandles } from '../api/bondApi';
|
|
import type { CandleItem } from '@/shared/api/responses';
|
|
|
|
export function useBondCandles(secid: string, interval: '1h' | '24h', from: string, till: string) {
|
|
return useQuery<CandleItem[]>({
|
|
queryKey: ['bondCandles', secid, interval, from, till],
|
|
queryFn: async () => {
|
|
const res = await getBondCandles(secid, interval, from, till);
|
|
return res.data;
|
|
},
|
|
staleTime: 3600_000,
|
|
});
|
|
}
|