15 lines
388 B
TypeScript
15 lines
388 B
TypeScript
import { useQuery } from '@tanstack/react-query';
|
|
import { getBond } from '../api/bondApi';
|
|
import type { BondResponse } from '@/shared/api/responses';
|
|
|
|
export function useBond(secid: string) {
|
|
return useQuery<BondResponse>({
|
|
queryKey: ['bond', secid],
|
|
queryFn: async () => {
|
|
const res = await getBond(secid);
|
|
return res.data;
|
|
},
|
|
staleTime: 900_000,
|
|
});
|
|
}
|