debug: add console logs to fetchEvents to diagnose empty results

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
HoneyandClaude Sonnet 4.6 committed 2026-06-08 01:26:18 +02:00
1 parent 98c964ecae
commit 4bb131b219
1 file changed
+7 -2
+7 -2
View File
@@ -3,14 +3,19 @@ import { S } from '../state.js';
export async function fetchEvents(artistName) {
const base = S.cfg?.backendUrl;
console.log('[events] base:', base, '| artist:', artistName);
if(!base) return [];
try {
const r = await fetch(`${base}/api/events/${encodeURIComponent(artistName)}`);
console.log('[events] status:', r.status);
if(!r.ok) return [];
const data = await r.json();
console.log('[events] data:', data);
if(!Array.isArray(data)) return [];
return data.filter(e => new Date(e.datetime) > new Date());
} catch { return []; }
const filtered = data.filter(e => new Date(e.datetime) > new Date());
console.log('[events] upcoming:', filtered.length);
return filtered;
} catch(e) { console.log('[events] error:', e); return []; }
}
export function openEventsModal(events, artistName) {