fix(lint): resolve remaining ESLint errors (unused vars, any types, react-refresh)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
* Step 5: Import & Verify (bulk-add, then check connectivity)
|
||||
*/
|
||||
|
||||
import { useState, useCallback, useEffect } from 'react'
|
||||
import { useState, useCallback } from 'react'
|
||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
|
||||
import { useNavigate } from '@tanstack/react-router'
|
||||
import {
|
||||
@@ -31,8 +31,6 @@ import {
|
||||
type SubnetScanResponse,
|
||||
type SubnetScanResult,
|
||||
type DeviceResponse,
|
||||
type DeviceGroupResponse,
|
||||
type DeviceTagResponse,
|
||||
} from '@/lib/api'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Input } from '@/components/ui/input'
|
||||
|
||||
@@ -32,7 +32,9 @@ export function RemoteWinBoxButton({ tenantId, deviceId }: RemoteWinBoxButtonPro
|
||||
(s) => s.status === 'active' || s.status === 'creating',
|
||||
)
|
||||
if (active) {
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect
|
||||
setSession(active)
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect
|
||||
setState(active.status === 'active' ? 'active' : 'connecting')
|
||||
}
|
||||
}
|
||||
@@ -66,6 +68,7 @@ export function RemoteWinBoxButton({ tenantId, deviceId }: RemoteWinBoxButtonPro
|
||||
// Countdown timer for session expiry
|
||||
useEffect(() => {
|
||||
if (state !== 'active' || !session?.expires_at) {
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect
|
||||
setCountdown(null)
|
||||
return
|
||||
}
|
||||
@@ -96,9 +99,10 @@ export function RemoteWinBoxButton({ tenantId, deviceId }: RemoteWinBoxButtonPro
|
||||
setState('connecting')
|
||||
}
|
||||
},
|
||||
onError: (err: any) => {
|
||||
onError: (err: unknown) => {
|
||||
const e = err as { response?: { data?: { detail?: string } } }
|
||||
setState('failed')
|
||||
setError(err.response?.data?.detail || 'Failed to create session')
|
||||
setError(e.response?.data?.detail || 'Failed to create session')
|
||||
},
|
||||
})
|
||||
|
||||
@@ -113,9 +117,10 @@ export function RemoteWinBoxButton({ tenantId, deviceId }: RemoteWinBoxButtonPro
|
||||
setError(null)
|
||||
queryClient.invalidateQueries({ queryKey: ['remote-winbox-sessions', tenantId, deviceId] })
|
||||
},
|
||||
onError: (err: any) => {
|
||||
onError: (err: unknown) => {
|
||||
const e = err as { response?: { data?: { detail?: string } } }
|
||||
setState('failed')
|
||||
setError(err.response?.data?.detail || 'Failed to close session')
|
||||
setError(e.response?.data?.detail || 'Failed to close session')
|
||||
},
|
||||
})
|
||||
|
||||
@@ -130,12 +135,6 @@ export function RemoteWinBoxButton({ tenantId, deviceId }: RemoteWinBoxButtonPro
|
||||
closeMutation.mutate()
|
||||
}, [closeMutation])
|
||||
|
||||
const handleRetry = useCallback(() => {
|
||||
setSession(null)
|
||||
setError(null)
|
||||
handleOpen()
|
||||
}, [handleOpen])
|
||||
|
||||
const handleReset = useCallback(async () => {
|
||||
try {
|
||||
const sessions = await remoteWinboxApi.list(tenantId, deviceId)
|
||||
|
||||
@@ -32,9 +32,10 @@ export function WinBoxButton({ tenantId, deviceId }: WinBoxButtonProps) {
|
||||
window.open(data.winbox_uri, '_blank')
|
||||
}
|
||||
},
|
||||
onError: (err: any) => {
|
||||
onError: (err: unknown) => {
|
||||
const e = err as { response?: { data?: { detail?: string } } }
|
||||
setState('error')
|
||||
setError(err.response?.data?.detail || 'Failed to open tunnel')
|
||||
setError(e.response?.data?.detail || 'Failed to open tunnel')
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user