From 67546d39af2b0087748125aa4589b356216e9d72 Mon Sep 17 00:00:00 2001 From: OpenSquared Date: Sat, 20 Jun 2026 06:27:43 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20URLs=20relatives=20pour=20VaR=20et=20Con?= =?UTF-8?q?fig=20(bypass=20proxy=20corrig=C3=A9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- frontend/src/pages/Config.tsx | 2 +- frontend/src/pages/VaRAnalysis.tsx | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/frontend/src/pages/Config.tsx b/frontend/src/pages/Config.tsx index 8e8a248..4d97372 100644 --- a/frontend/src/pages/Config.tsx +++ b/frontend/src/pages/Config.tsx @@ -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'], diff --git a/frontend/src/pages/VaRAnalysis.tsx b/frontend/src/pages/VaRAnalysis.tsx index 22aaeaa..bfb1e53 100644 --- a/frontend/src/pages/VaRAnalysis.tsx +++ b/frontend/src/pages/VaRAnalysis.tsx @@ -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() {