diff --git a/client/src/pages/Detections.tsx b/client/src/pages/Detections.tsx index 5989974..c4ee718 100644 --- a/client/src/pages/Detections.tsx +++ b/client/src/pages/Detections.tsx @@ -73,13 +73,12 @@ export default function Detections() { const totalCount = data?.total || 0; const totalPages = Math.ceil(totalCount / ITEMS_PER_PAGE); - // Fetch whitelist to check if IP is already whitelisted - const { data: whitelistData } = useQuery({ - queryKey: ["/api/whitelist"], + const { data: whitelistData } = useQuery<{ items: Whitelist[]; total: number }>({ + queryKey: ["/api/whitelist", "all"], + queryFn: () => fetch("/api/whitelist?limit=10000").then(r => r.json()), }); - // Create a Set of whitelisted IPs for fast lookup - const whitelistedIps = new Set(whitelistData?.map(w => w.ipAddress) || []); + const whitelistedIps = new Set(whitelistData?.items?.map(w => w.ipAddress) || []); // Mutation per aggiungere a whitelist const addToWhitelistMutation = useMutation({