Fix jwt-token

This commit is contained in:
2025-08-28 12:09:54 +02:00
parent fb334e30db
commit c86cfe72a6

View File

@@ -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 = () => {
</td>
<td>
<span className="text-sm text-gray-900">
{detection.drone_type === 0 ? 'Unknown' : `Type ${detection.drone_type}`}
{detection.drone_type_info?.name || `Type ${detection.drone_type}`}
</span>
{detection.drone_type_info?.category && (
<div className="text-xs text-gray-500">
{detection.drone_type_info.category}
</div>
)}
</td>
<td>
<span className="text-sm text-gray-900">