Spaces:
Running
Running
Commit
·
699b218
1
Parent(s):
84e44c2
Fix API URL for Cloud
Browse files- app/page.tsx +7 -1
app/page.tsx
CHANGED
|
@@ -11,6 +11,9 @@ import { Play, Square, RotateCcw, Zap, User, Fingerprint, Shield, Target } from
|
|
| 11 |
import { io, Socket } from "socket.io-client"
|
| 12 |
import Link from "next/link"
|
| 13 |
|
|
|
|
|
|
|
|
|
|
| 14 |
interface MetricData { timestamp: number; value: number; engagement: number; satisfaction: number; trust: number; }
|
| 15 |
interface UserInfo { firstName: string; lastName: string; clientId: string }
|
| 16 |
|
|
@@ -41,7 +44,10 @@ export default function Dashboard() {
|
|
| 41 |
// 2. Logique Socket & Envoi d'images
|
| 42 |
useEffect(() => {
|
| 43 |
if (!userInfo) return;
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
| 45 |
newSocket.on("connect", () => setIsConnected(true))
|
| 46 |
newSocket.on("disconnect", () => setIsConnected(false))
|
| 47 |
|
|
|
|
| 11 |
import { io, Socket } from "socket.io-client"
|
| 12 |
import Link from "next/link"
|
| 13 |
|
| 14 |
+
// --- CORRECTION ICI : ON UTILISE L'ADRESSE DU CLOUD ---
|
| 15 |
+
const API_URL = process.env.NEXT_PUBLIC_API_URL || "http://localhost:8000"
|
| 16 |
+
|
| 17 |
interface MetricData { timestamp: number; value: number; engagement: number; satisfaction: number; trust: number; }
|
| 18 |
interface UserInfo { firstName: string; lastName: string; clientId: string }
|
| 19 |
|
|
|
|
| 44 |
// 2. Logique Socket & Envoi d'images
|
| 45 |
useEffect(() => {
|
| 46 |
if (!userInfo) return;
|
| 47 |
+
|
| 48 |
+
// --- CORRECTION ICI : CONNEXION AU CLOUD ---
|
| 49 |
+
const newSocket = io(API_URL, { transports: ["websocket", "polling"] })
|
| 50 |
+
|
| 51 |
newSocket.on("connect", () => setIsConnected(true))
|
| 52 |
newSocket.on("disconnect", () => setIsConnected(false))
|
| 53 |
|