diff --git a/frontend/src/components/Dashboard.tsx b/frontend/src/components/Dashboard.tsx index 1316f18..7f60889 100644 --- a/frontend/src/components/Dashboard.tsx +++ b/frontend/src/components/Dashboard.tsx @@ -30,10 +30,13 @@ export default function Dashboard() { queryFn: apiClient.getAccounts, }); - const { data: healthStatus, isLoading: healthLoading } = useQuery({ + const { data: healthStatus, isLoading: healthLoading, isError: healthError } = useQuery({ queryKey: ['health'], queryFn: async () => { const response = await fetch(`${import.meta.env.VITE_API_URL || 'http://localhost:8000'}/api/v1/health`); + if (!response.ok) { + throw new Error(`Health check failed: ${response.status}`); + } return response.json(); }, refetchInterval: 30000, // Check every 30 seconds @@ -146,16 +149,16 @@ export default function Dashboard() { Checking... - ) : healthStatus?.success ? ( - <> - - Connected - - ) : ( + ) : healthError || !healthStatus?.success ? ( <> Disconnected + ) : ( + <> + + Connected + )}