@@ -92,6 +116,7 @@ export default function Cases() {
)}
))}
+ | Actions |
))}
@@ -103,6 +128,10 @@ export default function Cases() {
{flexRender(cell.column.columnDef.cell, cell.getContext())}
))}
+
+
+
+ |
))}
@@ -111,4 +140,4 @@ export default function Cases() {
);
-}
\ No newline at end of file
+}
diff --git a/services/dashboard/src/pages/Dashboard.tsx b/services/dashboard/src/pages/Dashboard.tsx
index 9fe4e3c..c4cf02d 100644
--- a/services/dashboard/src/pages/Dashboard.tsx
+++ b/services/dashboard/src/pages/Dashboard.tsx
@@ -11,6 +11,8 @@ type RiskEvent = {
};
};
+const API_BASE_URL = "http://localhost:8005";
+
export default function Dashboard() {
const [alerts, setAlerts] = useState([]);
const [latestEvent, setLatestEvent] = useState(null);
@@ -26,6 +28,22 @@ export default function Dashboard() {
});
useEffect(() => {
+ let cancelled = false;
+
+ fetch(`${API_BASE_URL}/api/history/dashboard-stats`)
+ .then((res) => res.json())
+ .then((data) => {
+ if (!cancelled) setStats(data);
+ })
+ .catch(() => undefined);
+
+ fetch(`${API_BASE_URL}/api/history/recent-alerts?limit=10`)
+ .then((res) => res.json())
+ .then((data: RiskEvent[]) => {
+ if (!cancelled) setAlerts(data);
+ })
+ .catch(() => undefined);
+
const ws = new WebSocket("ws://localhost:8005/ws");
ws.onopen = () => {
@@ -63,6 +81,7 @@ export default function Dashboard() {
ws.onclose = () => setWsConnected(false);
return () => {
+ cancelled = true;
setWsConnected(false);
ws.close();
};
From e9a4c1f1ca5ca22490a600b72901d0d3fb47a352 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Sun, 10 May 2026 18:18:15 +0000
Subject: [PATCH 3/3] Use configurable dashboard API URLs and improve case
status update handling
Agent-Logs-Url: https://github.com/Anuj-verse/fundGuard/sessions/3c83a29c-4361-461d-9aec-07c2636f4e3d
Co-authored-by: Anuj-verse <182001728+Anuj-verse@users.noreply.github.com>
---
services/dashboard/src/pages/Cases.tsx | 22 +++++++++++++++-------
services/dashboard/src/pages/Dashboard.tsx | 5 +++--
2 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/services/dashboard/src/pages/Cases.tsx b/services/dashboard/src/pages/Cases.tsx
index 0d9c45e..64ae936 100644
--- a/services/dashboard/src/pages/Cases.tsx
+++ b/services/dashboard/src/pages/Cases.tsx
@@ -8,6 +8,8 @@ import {
createColumnHelper
} from '@tanstack/react-table';
+const API_BASE_URL = import.meta.env.VITE_API_BASE_URL ?? 'http://localhost:8005';
+
type CaseData = {
id: string;
accountId: string;
@@ -63,7 +65,7 @@ export default function Cases() {
const loadCases = useCallback(async () => {
try {
- const response = await fetch('http://localhost:8005/api/cases')
+ const response = await fetch(`${API_BASE_URL}/api/cases`)
if (!response.ok) return
const items = (await response.json()) as CaseData[]
setData(items)
@@ -77,12 +79,18 @@ export default function Cases() {
}, [loadCases])
const updateStatus = useCallback(async (id: string, status: string) => {
- await fetch(`http://localhost:8005/api/cases/${id}`, {
- method: 'PATCH',
- headers: { 'Content-Type': 'application/json' },
- body: JSON.stringify({ status }),
- })
- loadCases()
+ try {
+ const response = await fetch(`${API_BASE_URL}/api/cases/${id}`, {
+ method: 'PATCH',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({ status }),
+ })
+ if (response.ok) {
+ loadCases()
+ }
+ } catch {
+ return
+ }
}, [loadCases])
const table = useReactTable({
diff --git a/services/dashboard/src/pages/Dashboard.tsx b/services/dashboard/src/pages/Dashboard.tsx
index c4cf02d..7ddc8f8 100644
--- a/services/dashboard/src/pages/Dashboard.tsx
+++ b/services/dashboard/src/pages/Dashboard.tsx
@@ -11,7 +11,8 @@ type RiskEvent = {
};
};
-const API_BASE_URL = "http://localhost:8005";
+const API_BASE_URL = import.meta.env.VITE_API_BASE_URL ?? "http://localhost:8005";
+const WS_URL = import.meta.env.VITE_WS_URL ?? API_BASE_URL.replace("http", "ws") + "/ws";
export default function Dashboard() {
const [alerts, setAlerts] = useState([]);
@@ -44,7 +45,7 @@ export default function Dashboard() {
})
.catch(() => undefined);
- const ws = new WebSocket("ws://localhost:8005/ws");
+ const ws = new WebSocket(WS_URL);
ws.onopen = () => {
streamStartedAt.current = Date.now();