()
| 17 | |
| 18 | useEffect(() => { |
| 19 | const fetchVersions = async () => { |
| 20 | const clientVersion = getVersionObject(); |
| 21 | |
| 22 | let apiVersion = { version: 'unknown', error: '' }; |
| 23 | try { |
| 24 | const response = await fetch(`${envData.apiLocation}/status/version`); |
| 25 | if (response.ok) { |
| 26 | apiVersion = (await response.json()) as { |
| 27 | version: string; |
| 28 | error: string; |
| 29 | }; |
| 30 | } else { |
| 31 | apiVersion.error = `HTTP ${response.status}`; |
| 32 | } |
| 33 | } catch (error) { |
| 34 | apiVersion.error = |
| 35 | error instanceof Error ? error.message : 'Failed to fetch'; |
| 36 | } |
| 37 | |
| 38 | setVersionData({ |
| 39 | client: clientVersion, |
| 40 | api: apiVersion |
| 41 | }); |
| 42 | }; |
| 43 | |
| 44 | void fetchVersions(); |
| 45 | }, []); |
no test coverage detected