27 lines
689 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

async function fetchApproved() {
try {
const response = await fetch('/api/approved');
const data = await response.json();
return data;
} catch (error) {
console.error('Error fetching approved data:', error);
return [];
}
}
async function updateTicker() {
const approvedData = await fetchApproved();
const tickerContent = approvedData
.map(entry => `${entry.name} (${entry.location}): ${entry.comment}`)
.join(' ');
const tickerElement = document.getElementById('ticker-content');
tickerElement.textContent = tickerContent;
}
// Fetch on load
updateTicker();
// Refresh every 30 seconds (adjust as needed)
setInterval(updateTicker, 30000);