- 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
17 lines
452 B
TypeScript
17 lines
452 B
TypeScript
import { useQuery } from '@tanstack/react-query'
|
|
import type { SearchResultItem } from '@/shared/api'
|
|
import { searchSecurities } from '../api/searchApi'
|
|
|
|
export function useSearch(query: string) {
|
|
return useQuery<SearchResultItem[]>({
|
|
queryKey: ['securities', 'search', query],
|
|
queryFn: async () => {
|
|
const res = await searchSecurities(query)
|
|
|
|
return res.data
|
|
},
|
|
enabled: query.length >= 2,
|
|
staleTime: 60_000,
|
|
})
|
|
}
|