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); if (value) params.append(key, value);
}); });
console.log('🔍 Fetching detections with params:', params.toString());
const response = await api.get(`/detections?${params}`); const response = await api.get(`/detections?${params}`);
setDetections(response.data.data); console.log('✅ Detections response:', response.data);
setPagination(response.data.pagination);
setDetections(response.data.detections || []);
setPagination(response.data.pagination || {});
} catch (error) { } catch (error) {
console.error('Error fetching detections:', error); console.error('Error fetching detections:', error);
setDetections([]); // Ensure detections is always an array
setPagination({});
} finally { } finally {
setLoading(false); setLoading(false);
} }
@@ -198,8 +203,13 @@ const Detections = () => {
</td> </td>
<td> <td>
<span className="text-sm text-gray-900"> <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> </span>
{detection.drone_type_info?.category && (
<div className="text-xs text-gray-500">
{detection.drone_type_info.category}
</div>
)}
</td> </td>
<td> <td>
<span className="text-sm text-gray-900"> <span className="text-sm text-gray-900">