nivakaran commited on
Commit
e78fedb
·
verified ·
1 Parent(s): 726f54b

Deploy from GitHub Actions

Browse files
frontend/app/components/dashboard/AnomalyDetection.tsx CHANGED
@@ -26,6 +26,9 @@ interface ModelStatus {
26
  batch_threshold: number;
27
  }
28
 
 
 
 
29
  const AnomalyDetection = () => {
30
  const [anomalies, setAnomalies] = useState<AnomalyEvent[]>([]);
31
  const [modelStatus, setModelStatus] = useState<ModelStatus | null>(null);
@@ -36,8 +39,8 @@ const AnomalyDetection = () => {
36
  try {
37
  setLoading(true);
38
  const [anomalyRes, statusRes] = await Promise.all([
39
- fetch('http://localhost:8000/api/anomalies?limit=20'),
40
- fetch('http://localhost:8000/api/model/status')
41
  ]);
42
 
43
  const anomalyData = await anomalyRes.json();
 
26
  batch_threshold: number;
27
  }
28
 
29
+ // Use environment variable for API base URL
30
+ const API_BASE = process.env.NEXT_PUBLIC_API_BASE || "http://localhost:8000";
31
+
32
  const AnomalyDetection = () => {
33
  const [anomalies, setAnomalies] = useState<AnomalyEvent[]>([]);
34
  const [modelStatus, setModelStatus] = useState<ModelStatus | null>(null);
 
39
  try {
40
  setLoading(true);
41
  const [anomalyRes, statusRes] = await Promise.all([
42
+ fetch(`${API_BASE}/api/anomalies?limit=20`),
43
+ fetch(`${API_BASE}/api/model/status`)
44
  ]);
45
 
46
  const anomalyData = await anomalyRes.json();