()
| 15 | const [latencyMs, setLatencyMs] = useState<number | null>(null); |
| 16 | |
| 17 | async function checkConnection() { |
| 18 | setConnectionStatus("checking"); |
| 19 | setLatencyMs(null); |
| 20 | const start = Date.now(); |
| 21 | try { |
| 22 | const res = await fetch(`${settings.apiUrl}/health`, { signal: AbortSignal.timeout(5000) }); |
| 23 | const ms = Date.now() - start; |
| 24 | setLatencyMs(ms); |
| 25 | setConnectionStatus(res.ok ? "ok" : "error"); |
| 26 | } catch { |
| 27 | setConnectionStatus("error"); |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | const statusIcon = { |
| 32 | idle: null, |
nothing calls this directly
no outgoing calls
no test coverage detected