- Delete shared/api/responses.ts, move type re-exports to index.ts - Update all 55+ imports from shared/api/responses to shared/api - Delete stale client.test.ts (tested deleted client.ts) - Run biome checks and fix import ordering - Update tasks.md and plan.md to reflect actual approach
16 lines
611 B
TypeScript
16 lines
611 B
TypeScript
import { useQuery } from '@tanstack/react-query'
|
|
import type { BrokerEventsData } from '@/shared/api'
|
|
import { type BrokerEventsQuery, getBrokerEvents } from '../api/brokerEventApi'
|
|
|
|
export function useBrokerEvents(accountId: string | undefined, query: BrokerEventsQuery) {
|
|
const { from, to, types } = query
|
|
return useQuery<BrokerEventsData>({
|
|
queryKey: ['broker', 'events', accountId, from, to, types],
|
|
enabled: Boolean(accountId),
|
|
queryFn: async () => (await getBrokerEvents(accountId!, { from, to, types })).data,
|
|
staleTime: 300_000,
|
|
retry: 2,
|
|
refetchOnWindowFocus: false,
|
|
})
|
|
}
|