Spaces:
Sleeping
Sleeping
Update public/script.js
Browse files- public/script.js +10 -2
public/script.js
CHANGED
|
@@ -538,8 +538,16 @@ activityCheck = setInterval(() => {
|
|
| 538 |
}, 250);
|
| 539 |
|
| 540 |
async function getTags() {
|
| 541 |
-
|
| 542 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 543 |
}
|
| 544 |
|
| 545 |
function putTagsInForm(tags) {
|
|
|
|
| 538 |
}, 250);
|
| 539 |
|
| 540 |
async function getTags() {
|
| 541 |
+
const response = await fetch("/api/tag.json?limit=1500&order=count");
|
| 542 |
+
|
| 543 |
+
// ADD THIS: If the server blocks us, don't try to parse JSON
|
| 544 |
+
if (!response.ok) {
|
| 545 |
+
console.error("API Blocked or Failed:", response.status);
|
| 546 |
+
return []; // Return empty list instead of crashing
|
| 547 |
+
}
|
| 548 |
+
|
| 549 |
+
const tags = await response.json();
|
| 550 |
+
return tags;
|
| 551 |
}
|
| 552 |
|
| 553 |
function putTagsInForm(tags) {
|