'use client'; import { useState, useEffect } from 'react'; interface SystemStatusProps { initialData: any; } export function SystemStatus({ initialData }: SystemStatusProps) { const [data, setData] = useState(initialData); useEffect(() => { const interval = setInterval(async () => { try { // Fetch from health endpoint with no-store/no-cache to ensure fresh data const res = await fetch('/api/v1/health', { cache: 'no-store', headers: { 'Cache-Control': 'no-cache', 'Pragma': 'no-cache' } }); if (res.ok) { const json = await res.json(); setData(json); } } catch (error) { console.error("Failed to refresh system status", error); } }, 5000); // Update every 5 seconds return () => clearInterval(interval); }, []); return (
            {JSON.stringify(data, null, 2)}
        
); }