feat: cockpit

This commit is contained in:
OpenSquared
2026-07-24 10:33:35 +02:00
parent 02a7cc2bd6
commit 2e5326f8bf
2 changed files with 29 additions and 3 deletions

View File

@@ -146,7 +146,15 @@ export const useAddWatchlistInstrument = () => {
export const useInstrumentCatalogIds = () =>
useQuery({
queryKey: ['instrument-analysis-catalog'],
queryFn: () => api.get('/instruments/').then(r => new Set((r.data ?? []).map((i: any) => String(i.id).toUpperCase()))),
// No trailing slash: the backend route is registered at "/api/instruments" exactly
// (router.get("")) — a trailing slash still resolves via FastAPI's redirect_slashes,
// but calling the exact path avoids depending on that 307 round-trip surviving the
// nginx proxy_pass unchanged.
queryFn: () => api.get('/instruments').then(r => {
const ids = new Set<string>((r.data ?? []).map((i: any) => String(i.id).toUpperCase()))
console.debug('[useInstrumentCatalogIds] loaded', ids.size, 'catalog ids:', Array.from(ids))
return ids
}),
staleTime: 10 * 60_000,
})