15 lines
437 B
TypeScript
15 lines
437 B
TypeScript
import { useQuery } from '@tanstack/react-query';
|
|
import { getShareDividends } from '@/shared/api/client';
|
|
import type { DividendItem } from '@/shared/api/responses';
|
|
|
|
export function useStockDividends(secid: string) {
|
|
return useQuery<DividendItem[]>({
|
|
queryKey: ['stockDividends', secid],
|
|
queryFn: async () => {
|
|
const res = await getShareDividends(secid);
|
|
return res.data;
|
|
},
|
|
staleTime: 86400_000,
|
|
});
|
|
}
|