diff --git a/client/src/pages/Detections.jsx b/client/src/pages/Detections.jsx index 2ccfc43..f8f5b28 100644 --- a/client/src/pages/Detections.jsx +++ b/client/src/pages/Detections.jsx @@ -34,11 +34,16 @@ const Detections = () => { if (value) params.append(key, value); }); + console.log('🔍 Fetching detections with params:', params.toString()); const response = await api.get(`/detections?${params}`); - setDetections(response.data.data); - setPagination(response.data.pagination); + console.log('✅ Detections response:', response.data); + + setDetections(response.data.detections || []); + setPagination(response.data.pagination || {}); } catch (error) { - console.error('Error fetching detections:', error); + console.error('❌ Error fetching detections:', error); + setDetections([]); // Ensure detections is always an array + setPagination({}); } finally { setLoading(false); } @@ -198,8 +203,13 @@ const Detections = () => {