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:
@@ -56,7 +56,7 @@ export function BulkDeployDialog({
|
||||
queryKey: ['devices-for-cert', tenantId],
|
||||
queryFn: async () => {
|
||||
const result = await devicesApi.list(tenantId)
|
||||
return (result as any).items ?? result
|
||||
return (result as { items?: DeviceResponse[] }).items ?? (result as DeviceResponse[])
|
||||
},
|
||||
enabled: !!tenantId && open,
|
||||
})
|
||||
@@ -128,14 +128,15 @@ export function BulkDeployDialog({
|
||||
variant: 'destructive',
|
||||
})
|
||||
}
|
||||
} catch (e: any) {
|
||||
} catch (e: unknown) {
|
||||
const err = e as { response?: { data?: { detail?: string } } }
|
||||
setResult({
|
||||
success: 0,
|
||||
failed: selected.size,
|
||||
errors: [
|
||||
{
|
||||
device_id: 'bulk',
|
||||
error: e?.response?.data?.detail || 'Bulk deployment failed',
|
||||
error: err?.response?.data?.detail || 'Bulk deployment failed',
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
@@ -36,11 +36,13 @@ export function CAStatusCard({ ca, canWrite: writable, tenantId }: CAStatusCardP
|
||||
void queryClient.invalidateQueries({ queryKey: ['ca'] })
|
||||
toast({ title: 'Certificate Authority initialized' })
|
||||
},
|
||||
onError: (e: any) =>
|
||||
onError: (e: unknown) => {
|
||||
const err = e as { response?: { data?: { detail?: string } } }
|
||||
toast({
|
||||
title: e?.response?.data?.detail || 'Failed to initialize CA',
|
||||
title: err?.response?.data?.detail || 'Failed to initialize CA',
|
||||
variant: 'destructive',
|
||||
}),
|
||||
})
|
||||
},
|
||||
})
|
||||
|
||||
const handleDownloadPEM = async () => {
|
||||
|
||||
@@ -43,6 +43,7 @@ export function CertConfirmDialog({
|
||||
// Reset confirm text when dialog opens/closes or action changes
|
||||
useEffect(() => {
|
||||
if (open) {
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect
|
||||
setConfirmText('')
|
||||
}
|
||||
}, [open, action])
|
||||
|
||||
@@ -9,11 +9,7 @@
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { useUIStore } from '@/lib/store'
|
||||
import { Shield, Building2 } from 'lucide-react'
|
||||
import {
|
||||
certificatesApi,
|
||||
type CAResponse,
|
||||
type DeviceCertResponse,
|
||||
} from '@/lib/certificatesApi'
|
||||
import { certificatesApi } from '@/lib/certificatesApi'
|
||||
import { useAuth, isSuperAdmin } from '@/lib/auth'
|
||||
import { canWrite } from '@/lib/auth'
|
||||
import { CAStatusCard } from './CAStatusCard'
|
||||
|
||||
@@ -58,7 +58,7 @@ export function DeployCertDialog({
|
||||
queryFn: async () => {
|
||||
const result = await devicesApi.list(tenantId)
|
||||
// The list endpoint returns { items, total, ... } or an array
|
||||
return (result as any).items ?? result
|
||||
return (result as { items?: DeviceResponse[] }).items ?? (result as DeviceResponse[])
|
||||
},
|
||||
enabled: !!tenantId && open,
|
||||
})
|
||||
@@ -110,9 +110,10 @@ export function DeployCertDialog({
|
||||
setErrorMsg(result.error ?? 'Deployment failed')
|
||||
toast({ title: result.error ?? 'Deployment failed', variant: 'destructive' })
|
||||
}
|
||||
} catch (e: any) {
|
||||
} catch (e: unknown) {
|
||||
setStep('error')
|
||||
const detail = e?.response?.data?.detail || 'Failed to deploy certificate'
|
||||
const err = e as { response?: { data?: { detail?: string } } }
|
||||
const detail = err?.response?.data?.detail || 'Failed to deploy certificate'
|
||||
setErrorMsg(detail)
|
||||
toast({ title: detail, variant: 'destructive' })
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import { useState } from 'react'
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query'
|
||||
import {
|
||||
ShieldCheck,
|
||||
ShieldAlert,
|
||||
Plus,
|
||||
Layers,
|
||||
MoreHorizontal,
|
||||
@@ -132,11 +131,13 @@ export function DeviceCertTable({
|
||||
toast({ title: result.error ?? 'Deployment failed', variant: 'destructive' })
|
||||
}
|
||||
},
|
||||
onError: (e: any) =>
|
||||
onError: (e: unknown) => {
|
||||
const err = e as { response?: { data?: { detail?: string } } }
|
||||
toast({
|
||||
title: e?.response?.data?.detail || 'Failed to deploy certificate',
|
||||
title: err?.response?.data?.detail || 'Failed to deploy certificate',
|
||||
variant: 'destructive',
|
||||
}),
|
||||
})
|
||||
},
|
||||
})
|
||||
|
||||
const rotateMutation = useMutation({
|
||||
@@ -149,11 +150,13 @@ export function DeviceCertTable({
|
||||
toast({ title: result.error ?? 'Rotation failed', variant: 'destructive' })
|
||||
}
|
||||
},
|
||||
onError: (e: any) =>
|
||||
onError: (e: unknown) => {
|
||||
const err = e as { response?: { data?: { detail?: string } } }
|
||||
toast({
|
||||
title: e?.response?.data?.detail || 'Failed to rotate certificate',
|
||||
title: err?.response?.data?.detail || 'Failed to rotate certificate',
|
||||
variant: 'destructive',
|
||||
}),
|
||||
})
|
||||
},
|
||||
})
|
||||
|
||||
const revokeMutation = useMutation({
|
||||
@@ -162,11 +165,13 @@ export function DeviceCertTable({
|
||||
void queryClient.invalidateQueries({ queryKey: ['deviceCerts'] })
|
||||
toast({ title: 'Certificate revoked' })
|
||||
},
|
||||
onError: (e: any) =>
|
||||
onError: (e: unknown) => {
|
||||
const err = e as { response?: { data?: { detail?: string } } }
|
||||
toast({
|
||||
title: e?.response?.data?.detail || 'Failed to revoke certificate',
|
||||
title: err?.response?.data?.detail || 'Failed to revoke certificate',
|
||||
variant: 'destructive',
|
||||
}),
|
||||
})
|
||||
},
|
||||
})
|
||||
|
||||
// ── Filtering ──
|
||||
|
||||
Reference in New Issue
Block a user