feat(indices): add authenticated OpenFIGI search
Add the bounded OpenFIGI v3 adapter, authenticated search route, and server-side configuration. Refs #3 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@ -1,5 +1,12 @@
|
||||
const BASE = '/api'
|
||||
|
||||
export class ApiError extends Error {
|
||||
constructor(message: string, public readonly status: number) {
|
||||
super(message)
|
||||
this.name = 'ApiError'
|
||||
}
|
||||
}
|
||||
|
||||
function getToken() {
|
||||
return localStorage.getItem('token')
|
||||
}
|
||||
@ -22,7 +29,7 @@ async function request<T>(path: string, options: RequestInit = {}): Promise<T> {
|
||||
}
|
||||
if (!res.ok) {
|
||||
const err = await res.json().catch(() => ({ error: res.statusText }))
|
||||
throw new Error(err.error || res.statusText)
|
||||
throw new ApiError(err.error || res.statusText, res.status)
|
||||
}
|
||||
if (res.status === 204) return undefined as T
|
||||
const json = await res.json()
|
||||
|
||||
Reference in New Issue
Block a user