2026-04-10 21:31:16 +02:00

19 lines
405 B
JavaScript

export async function fetchEvents(city) {
const url = `http://localhost:3000/api/events?city=${city}`;
try {
const response = await fetch(url);
if (!response.ok) {
throw new Error("API request failed");
}
const data = await response.json();
return data._embedded?.events || [];
} catch (error) {
console.error("Error fetching events:", error);
return [];
}
}