refactor(web): consume api v1 contracts

This commit is contained in:
2026-07-21 16:29:42 +08:00
parent e91c57e220
commit fe0c4e312e
9 changed files with 332 additions and 165 deletions

View File

@@ -104,10 +104,10 @@ async function checkServerStatus(
setStatus('checking')
try {
const response = await fetch(`${baseUrl}/api/status`, { signal })
const response = await fetch(`${baseUrl}/api/v1/status`, { signal })
if (!response.ok) throw new Error(`HTTP ${response.status}`)
const payload = await response.json() as { timestamp_ms?: number }
if (typeof payload.timestamp_ms !== 'number') throw new Error('invalid status payload')
const payload = await response.json() as { timestamp?: string }
if (typeof payload.timestamp !== 'string') throw new Error('invalid status payload')
setStatus('online')
} catch (error) {
if (error instanceof DOMException && error.name === 'AbortError') return