Spaces:
Running
Running
Update src/templates/reports/watchlist.html
Browse files
src/templates/reports/watchlist.html
CHANGED
|
@@ -339,16 +339,25 @@
|
|
| 339 |
async function deleteCurrent() {
|
| 340 |
if (!currentCoin || !confirm('Permanently remove research?')) return;
|
| 341 |
const targetId = currentCoin.coin_id;
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 352 |
}
|
| 353 |
document.addEventListener('DOMContentLoaded', renderBubbles);
|
| 354 |
</script>
|
|
|
|
| 339 |
async function deleteCurrent() {
|
| 340 |
if (!currentCoin || !confirm('Permanently remove research?')) return;
|
| 341 |
const targetId = currentCoin.coin_id;
|
| 342 |
+
|
| 343 |
+
try {
|
| 344 |
+
const res = await fetch('/api/watchlist/toggle', {
|
| 345 |
+
method: 'POST',
|
| 346 |
+
headers: {'Content-Type': 'application/json'},
|
| 347 |
+
body: JSON.stringify({ coin_id: targetId, action: 'remove' })
|
| 348 |
+
});
|
| 349 |
+
const data = await res.json();
|
| 350 |
+
if (res.ok && data.status === 'success') {
|
| 351 |
+
watchlistData = watchlistData.filter(c => c.coin_id !== targetId);
|
| 352 |
+
renderBubbles();
|
| 353 |
+
closeOverlay();
|
| 354 |
+
} else {
|
| 355 |
+
alert('Failed to remove from watchlist. Please try again.');
|
| 356 |
+
}
|
| 357 |
+
} catch(e) {
|
| 358 |
+
console.error('Watchlist delete error:', e);
|
| 359 |
+
alert('Connection error. Please try again.');
|
| 360 |
+
}
|
| 361 |
}
|
| 362 |
document.addEventListener('DOMContentLoaded', renderBubbles);
|
| 363 |
</script>
|