Spaces:
Running
Running
update
Browse files
app.js
CHANGED
|
@@ -5,9 +5,19 @@ const BASE_URL = "https://static-arxiv.taesiri.xyz";
|
|
| 5 |
function $(id) { return document.getElementById(id); }
|
| 6 |
|
| 7 |
async function fetchJSON(url) {
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
}
|
| 12 |
|
| 13 |
async function fetchText(url) {
|
|
@@ -73,7 +83,13 @@ async function loadDatasetSummary() {
|
|
| 73 |
console.error('Failed to load dataset summary:', error);
|
| 74 |
console.error('Error details:', error.message);
|
| 75 |
console.error('URL attempted:', `${BASE_URL}/dataset_summary.json`);
|
| 76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
return null;
|
| 78 |
}
|
| 79 |
}
|
|
|
|
| 5 |
function $(id) { return document.getElementById(id); }
|
| 6 |
|
| 7 |
async function fetchJSON(url) {
|
| 8 |
+
try {
|
| 9 |
+
const res = await fetch(url);
|
| 10 |
+
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
| 11 |
+
return await res.json();
|
| 12 |
+
} catch (error) {
|
| 13 |
+
console.error('Fetch error:', error);
|
| 14 |
+
console.error('Failed URL:', url);
|
| 15 |
+
// Check if it's a CORS error
|
| 16 |
+
if (error.message.includes('Failed to fetch') || error.name === 'TypeError') {
|
| 17 |
+
throw new Error(`CORS or network error - ${error.message}`);
|
| 18 |
+
}
|
| 19 |
+
throw error;
|
| 20 |
+
}
|
| 21 |
}
|
| 22 |
|
| 23 |
async function fetchText(url) {
|
|
|
|
| 83 |
console.error('Failed to load dataset summary:', error);
|
| 84 |
console.error('Error details:', error.message);
|
| 85 |
console.error('URL attempted:', `${BASE_URL}/dataset_summary.json`);
|
| 86 |
+
|
| 87 |
+
// Check if it's a CORS issue
|
| 88 |
+
if (error.message.includes('CORS')) {
|
| 89 |
+
showStatus('CORS error: Server needs to allow cross-origin requests. Check browser console for details.', 'error');
|
| 90 |
+
} else {
|
| 91 |
+
showStatus('Failed to load dataset summary. Check browser console for details.', 'error');
|
| 92 |
+
}
|
| 93 |
return null;
|
| 94 |
}
|
| 95 |
}
|