refactor: reorganize imports and improve error handling across components

This commit is contained in:
Wikid82
2025-11-20 22:21:32 -05:00
parent 9f62a4a2df
commit 62904858b2
23 changed files with 271 additions and 169 deletions

View File

@@ -1,6 +1,5 @@
import { useEffect, useState } from 'react'
import type { RemoteServer } from '../api/remoteServers'
import { remoteServersAPI } from '../services/api'
import { type RemoteServer, testRemoteServerConnection } from '../api/remoteServers'
interface Props {
server?: RemoteServer
@@ -50,9 +49,9 @@ export default function RemoteServerForm({ server, onSubmit, onCancel }: Props)
setLoading(true)
setError(null)
try {
const result = await remoteServersAPI.test(server.uuid)
const result = await testRemoteServerConnection(server.uuid)
alert(`Connection successful: ${result.address}`)
} catch (err) {
} catch {
setError('Connection failed')
} finally {
setLoading(false)