diff --git a/frontend/src/components/AccessListForm.tsx b/frontend/src/components/AccessListForm.tsx index cd55f25c..cbb0e293 100644 --- a/frontend/src/components/AccessListForm.tsx +++ b/frontend/src/components/AccessListForm.tsx @@ -162,7 +162,7 @@ export function AccessListForm({ initialData, onSubmit, onCancel, onDelete, isLo const result = await getMyIP(); setNewIP(result.ip); toast.success(`Your IP: ${result.ip} (from ${result.source})`); - } catch (error) { + } catch { toast.error('Failed to fetch your IP address'); } finally { setLoadingMyIP(false); diff --git a/frontend/src/components/CertificateList.tsx b/frontend/src/components/CertificateList.tsx index d97fb743..4568f534 100644 --- a/frontend/src/components/CertificateList.tsx +++ b/frontend/src/components/CertificateList.tsx @@ -21,7 +21,7 @@ export default function CertificateList() { queryClient.invalidateQueries({ queryKey: ['certificates'] }) toast.success('Certificate deleted') }, - onError: (error: any) => { + onError: (error: Error) => { toast.error(`Failed to delete certificate: ${error.message}`) }, }) diff --git a/frontend/src/components/__tests__/ProxyHostForm.test.tsx b/frontend/src/components/__tests__/ProxyHostForm.test.tsx index b1b418f1..0d29ddf3 100644 --- a/frontend/src/components/__tests__/ProxyHostForm.test.tsx +++ b/frontend/src/components/__tests__/ProxyHostForm.test.tsx @@ -94,7 +94,7 @@ const renderWithClient = (ui: React.ReactElement) => { import { testProxyHostConnection } from '../../api/proxyHosts' describe('ProxyHostForm', () => { - const mockOnSubmit = vi.fn((_data: any) => Promise.resolve()) + const mockOnSubmit = vi.fn(() => Promise.resolve()) const mockOnCancel = vi.fn() beforeEach(() => { @@ -183,7 +183,7 @@ describe('ProxyHostForm', () => { }) it('tests connection successfully', async () => { - (testProxyHostConnection as any).mockResolvedValue({}) + vi.mocked(testProxyHostConnection).mockResolvedValue(undefined) renderWithClient( @@ -202,7 +202,7 @@ describe('ProxyHostForm', () => { }) it('handles connection test failure', async () => { - (testProxyHostConnection as any).mockRejectedValue(new Error('Connection failed')) + vi.mocked(testProxyHostConnection).mockRejectedValue(new Error('Connection failed')) renderWithClient( diff --git a/frontend/src/pages/Account.tsx b/frontend/src/pages/Account.tsx index 6a34b521..d7a107b7 100644 --- a/frontend/src/pages/Account.tsx +++ b/frontend/src/pages/Account.tsx @@ -91,7 +91,7 @@ export default function Account() { queryClient.invalidateQueries({ queryKey: ['profile'] }) toast.success('Profile updated successfully') }, - onError: (error: any) => { + onError: (error: Error) => { toast.error(`Failed to update profile: ${error.message}`) }, }) @@ -103,7 +103,7 @@ export default function Account() { queryClient.invalidateQueries({ queryKey: ['settings'] }) toast.success('Certificate email updated') }, - onError: (error: any) => { + onError: (error: Error) => { toast.error(`Failed to update certificate email: ${error.message}`) }, }) @@ -114,7 +114,7 @@ export default function Account() { queryClient.invalidateQueries({ queryKey: ['profile'] }) toast.success('API Key regenerated successfully') }, - onError: (error: any) => { + onError: (error: Error) => { toast.error(`Failed to regenerate API key: ${error.message}`) }, }) @@ -223,7 +223,8 @@ export default function Account() { setOldPassword('') setNewPassword('') setConfirmPassword('') - } catch (error: any) { + } catch (err) { + const error = err as Error toast.error(error.message || 'Failed to update password') } finally { setLoading(false) diff --git a/frontend/src/pages/Certificates.tsx b/frontend/src/pages/Certificates.tsx index c6f01e17..b2dffce0 100644 --- a/frontend/src/pages/Certificates.tsx +++ b/frontend/src/pages/Certificates.tsx @@ -27,7 +27,7 @@ export default function Certificates() { setKeyFile(null) toast.success('Certificate uploaded successfully') }, - onError: (error: any) => { + onError: (error: Error) => { toast.error(`Failed to upload certificate: ${error.message}`) }, }) diff --git a/frontend/src/pages/Domains.tsx b/frontend/src/pages/Domains.tsx index e6c5bec2..155f5ffb 100644 --- a/frontend/src/pages/Domains.tsx +++ b/frontend/src/pages/Domains.tsx @@ -15,7 +15,7 @@ export default function Domains() { try { await createDomain(newDomain) setNewDomain('') - } catch (err) { + } catch { alert('Failed to create domain') } finally { setIsSubmitting(false) @@ -26,7 +26,7 @@ export default function Domains() { if (confirm('Are you sure you want to delete this domain?')) { try { await deleteDomain(uuid) - } catch (err) { + } catch { alert('Failed to delete domain') } } diff --git a/frontend/src/pages/Login.tsx b/frontend/src/pages/Login.tsx index 3e82e72a..a3d806d6 100644 --- a/frontend/src/pages/Login.tsx +++ b/frontend/src/pages/Login.tsx @@ -40,8 +40,9 @@ export default function Login() { await queryClient.invalidateQueries({ queryKey: ['setupStatus'] }) toast.success('Logged in successfully') navigate('/') - } catch (err: any) { - toast.error(err.response?.data?.error || 'Login failed') + } catch (err) { + const error = err as { response?: { data?: { error?: string } } } + toast.error(error.response?.data?.error || 'Login failed') } finally { setLoading(false) } diff --git a/frontend/src/pages/Notifications.tsx b/frontend/src/pages/Notifications.tsx index fdccb419..770deef9 100644 --- a/frontend/src/pages/Notifications.tsx +++ b/frontend/src/pages/Notifications.tsx @@ -9,7 +9,7 @@ import { useForm } from 'react-hook-form'; const ProviderForm: React.FC<{ initialData?: Partial; onClose: () => void; - onSubmit: (data: any) => void; + onSubmit: (data: Partial) => void; }> = ({ initialData, onClose, onSubmit }) => { const { register, handleSubmit, watch, setValue, formState: { errors } } = useForm({ defaultValues: initialData || { @@ -40,7 +40,7 @@ const ProviderForm: React.FC<{ const handleTest = () => { const formData = watch(); - testMutation.mutate(formData as any); + testMutation.mutate(formData as Partial); }; const type = watch('type'); @@ -197,7 +197,7 @@ const Notifications: React.FC = () => { }); const updateMutation = useMutation({ - mutationFn: ({ id, data }: { id: string; data: any }) => updateProvider(id, data), + mutationFn: ({ id, data }: { id: string; data: Partial }) => updateProvider(id, data), onSuccess: () => { queryClient.invalidateQueries({ queryKey: ['notificationProviders'] }); setEditingId(null); @@ -214,7 +214,7 @@ const Notifications: React.FC = () => { const testMutation = useMutation({ mutationFn: testProvider, onSuccess: () => alert('Test notification sent!'), - onError: (err: any) => alert(`Failed to send test: ${err.response?.data?.error || err.message}`), + onError: (err: Error) => alert(`Failed to send test: ${err.message}`), }); if (isLoading) return
Loading...
; diff --git a/frontend/src/pages/ProxyHosts.tsx b/frontend/src/pages/ProxyHosts.tsx index 6ac38673..35e89e1c 100644 --- a/frontend/src/pages/ProxyHosts.tsx +++ b/frontend/src/pages/ProxyHosts.tsx @@ -190,7 +190,7 @@ export default function ProxyHosts() { try { await deleteHost(uuid) deleted++ - } catch (err) { + } catch { failed++ } } diff --git a/frontend/src/pages/Setup.tsx b/frontend/src/pages/Setup.tsx index b7d7dcb4..53b138a9 100644 --- a/frontend/src/pages/Setup.tsx +++ b/frontend/src/pages/Setup.tsx @@ -65,8 +65,8 @@ const Setup: React.FC = () => { await queryClient.invalidateQueries({ queryKey: ['setupStatus'] }); navigate('/'); }, - onError: (err: any) => { - setError(err.response?.data?.error || 'Setup failed'); + onError: (err: Error) => { + setError(err.message || 'Setup failed'); }, }); diff --git a/frontend/src/pages/SystemSettings.tsx b/frontend/src/pages/SystemSettings.tsx index 05feaf3d..1cbf450a 100644 --- a/frontend/src/pages/SystemSettings.tsx +++ b/frontend/src/pages/SystemSettings.tsx @@ -77,7 +77,7 @@ export default function SystemSettings() { queryClient.invalidateQueries({ queryKey: ['settings'] }) toast.success('System settings saved') }, - onError: (error: any) => { + onError: (error: Error) => { toast.error(`Failed to save settings: ${error.message}`) }, }) diff --git a/frontend/src/pages/Uptime.tsx b/frontend/src/pages/Uptime.tsx index bdce081f..3d630f4d 100644 --- a/frontend/src/pages/Uptime.tsx +++ b/frontend/src/pages/Uptime.tsx @@ -67,7 +67,7 @@ const MonitorCard: React.FC<{ monitor: UptimeMonitor; onEdit: (monitor: UptimeMo
))} - {history?.slice().reverse().map((beat: any, i: number) => ( + {history?.slice().reverse().map((beat: { status: string; created_at: string; latency: number; message: string }, i: number) => (