davidepanza commited on
Commit
18029dc
·
verified ·
1 Parent(s): 7759b52

Update src/App.jsx

Browse files
Files changed (1) hide show
  1. src/App.jsx +0 -22
src/App.jsx CHANGED
@@ -19,9 +19,6 @@ const EarthquakeApp = () => {
19
  setError('');
20
 
21
  try {
22
- console.log('Making request to /api/proxy...');
23
- console.log('Request payload:', { start_date: startDate, end_date: endDate });
24
-
25
  const response = await fetch('/api/proxy', {
26
  method: 'POST',
27
  headers: {
@@ -33,44 +30,25 @@ const EarthquakeApp = () => {
33
  })
34
  });
35
 
36
- console.log('Response status:', response.status);
37
- console.log('Response headers:', Object.fromEntries(response.headers.entries()));
38
-
39
  if (!response.ok) {
40
  const errorData = await response.json();
41
  throw new Error(errorData.detail || `HTTP error! status: ${response.status}`);
42
  }
43
 
44
  const data = await response.json();
45
-
46
- // 🔍 DEBUG: Log the actual response structure
47
- console.log('Full API response:', data);
48
- console.log('Type of data:', typeof data);
49
- console.log('Data keys:', Object.keys(data || {}));
50
- console.log('data.data exists:', !!data.data);
51
- console.log('data.data type:', Array.isArray(data.data) ? 'array' : typeof data.data);
52
- console.log('data.data length:', data.data ? data.data.length : 'N/A');
53
-
54
- // Use the same logic as your original working code
55
  const sortedData = (data.data || []).sort((a, b) =>
56
  new Date(a.full_time) - new Date(b.full_time)
57
  );
58
 
59
- console.log('Sorted data length:', sortedData.length);
60
- console.log('First item:', sortedData[0]);
61
- console.log('Sample earthquake data:', sortedData.slice(0, 3));
62
-
63
  setEarthquakeData(sortedData);
64
  setCurrentIndex(0);
65
  setIsPlaying(false);
66
 
67
  if (sortedData.length === 0) {
68
- console.warn('No earthquake data found for the given date range');
69
  setError('No earthquake data found for the selected date range');
70
  }
71
 
72
  } catch (err) {
73
- console.error('Fetch error:', err);
74
  setError(`Failed to fetch data: ${err.message}`);
75
  } finally {
76
  setLoading(false);
 
19
  setError('');
20
 
21
  try {
 
 
 
22
  const response = await fetch('/api/proxy', {
23
  method: 'POST',
24
  headers: {
 
30
  })
31
  });
32
 
 
 
 
33
  if (!response.ok) {
34
  const errorData = await response.json();
35
  throw new Error(errorData.detail || `HTTP error! status: ${response.status}`);
36
  }
37
 
38
  const data = await response.json();
 
 
 
 
 
 
 
 
 
 
39
  const sortedData = (data.data || []).sort((a, b) =>
40
  new Date(a.full_time) - new Date(b.full_time)
41
  );
42
 
 
 
 
 
43
  setEarthquakeData(sortedData);
44
  setCurrentIndex(0);
45
  setIsPlaying(false);
46
 
47
  if (sortedData.length === 0) {
 
48
  setError('No earthquake data found for the selected date range');
49
  }
50
 
51
  } catch (err) {
 
52
  setError(`Failed to fetch data: ${err.message}`);
53
  } finally {
54
  setLoading(false);