fix: URLs relatives pour VaR et Config (bypass proxy corrigé)

Remplace http://localhost:8000 par des URLs relatives (/api/...)
pour passer par le proxy Vite/Nginx comme toutes les autres pages.
Cause du NetworkError en prod Docker.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
OpenSquared
2026-06-20 06:27:43 +02:00
parent b4f3089c58
commit 67546d39af
2 changed files with 5 additions and 7 deletions

View File

@@ -4,7 +4,7 @@ import { useSources, useUpdateSources, useUpdateApiKeys, useConfig, useAiStatus,
import { Settings, Key, Globe, CheckCircle, XCircle, AlertCircle, Save, Eye, EyeOff, Brain, SlidersHorizontal, RefreshCw, Zap, Plus, Trash2, Pencil, X, Lock, Gauge, DollarSign } from 'lucide-react'
import clsx from 'clsx'
const API = 'http://localhost:8000'
const API = ''
const SOURCE_CATEGORIES = {
'Flux RSS actifs': ['reuters_world', 'reuters_business', 'reuters_energy', 'ap_top', 'aljazeera', 'ft', 'bloomberg'],

View File

@@ -7,19 +7,17 @@ import {
import { ShieldAlert, TrendingDown, Activity, AlertTriangle, Info, Play, Clock, Database } from 'lucide-react'
import clsx from 'clsx'
const API = 'http://localhost:8000'
// ─── API calls ───────────────────────────────────────────────────────────────
async function fetchLatest() {
const r = await fetch(`${API}/api/var/latest`)
const r = await fetch('/api/var/latest')
if (!r.ok) throw new Error(`Backend inaccessible (${r.status})`)
return r.json()
}
async function runNow(params: { confidence: number; horizon_days: number; lookback_days: number; default_iv: number }) {
const qs = new URLSearchParams(Object.entries(params).map(([k, v]) => [k, String(v)])).toString()
const r = await fetch(`${API}/api/var/run-now?${qs}`, { method: 'POST' })
const r = await fetch(`/api/var/run-now?${qs}`, { method: 'POST' })
if (!r.ok) {
const txt = await r.text()
throw new Error(txt)
@@ -28,7 +26,7 @@ async function runNow(params: { confidence: number; horizon_days: number; lookba
}
async function fetchSnapshots() {
const r = await fetch(`${API}/api/var/snapshots?limit=10`)
const r = await fetch('/api/var/snapshots?limit=10')
if (!r.ok) return { snapshots: [] }
return r.json()
}
@@ -294,7 +292,7 @@ export default function VaRAnalysis() {
<button
key={s.id}
onClick={() => {
fetch(`${API}/api/var/snapshots/${s.id}`).then(r => r.json()).then(d => setActiveSnap(d.full_result))
fetch(`/api/var/snapshots/${s.id}`).then(r => r.json()).then(d => setActiveSnap(d.full_result))
}}
className={clsx('text-xs px-2 py-1 rounded',
activeSnap?.snapshot_id === s.id