Fix jwt-token
This commit is contained in:
@@ -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">
|
||||||
|
|||||||
Reference in New Issue
Block a user