feat: cockpit
This commit is contained in:
@@ -140,24 +140,6 @@ export const useAddWatchlistInstrument = () => {
|
||||
})
|
||||
}
|
||||
|
||||
// Instrument Analysis runs on its own separate catalog (backend config/instruments.json,
|
||||
// not services.database.instruments_watchlist) — used to gate navigation links so we
|
||||
// don't send the user to a 404/error page for a ticker that isn't registered there.
|
||||
export const useInstrumentCatalogIds = () =>
|
||||
useQuery({
|
||||
queryKey: ['instrument-analysis-catalog'],
|
||||
// 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,
|
||||
})
|
||||
|
||||
export const useWatchlistHistory = (ticker: string, period: string) =>
|
||||
useQuery({
|
||||
queryKey: ['instruments-watchlist-history', ticker, period],
|
||||
|
||||
Reference in New Issue
Block a user