| 308 | ]); |
| 309 | |
| 310 | async function handleTestConnection() { |
| 311 | setIsTestingConnection(true); |
| 312 | setErrorMessage(null); |
| 313 | try { |
| 314 | const report = await api<ConnectionReport>('/api/test-connection', { |
| 315 | method: 'POST', |
| 316 | body: { config }, |
| 317 | }); |
| 318 | setConnectionReport(report); |
| 319 | if (!report.ok) { |
| 320 | setShowSettings(true); |
| 321 | } |
| 322 | } catch (error) { |
| 323 | setErrorMessage(error instanceof Error ? error.message : String(error)); |
| 324 | } finally { |
| 325 | setIsTestingConnection(false); |
| 326 | } |
| 327 | } |
| 328 | |
| 329 | async function handleRefreshDiagnostics() { |
| 330 | setIsLoadingDiagnostics(true); |