This commit is contained in:
@ -8,39 +8,13 @@ import ImageCarousel from "../components/ImageCarousel.astro";
|
||||
import Contact from "../components/Contact.astro";
|
||||
import About from "../components/About.astro";
|
||||
|
||||
const API_BASE = 'https://cms.gallus-pub.ch';
|
||||
const events = [
|
||||
|
||||
// Fetch events from backend API
|
||||
let events = [];
|
||||
try {
|
||||
const eventsResponse = await fetch(`${API_BASE}/api/events/public`);
|
||||
if (eventsResponse.ok) {
|
||||
const eventsData = await eventsResponse.json();
|
||||
events = (eventsData.events || []).map((ev: any) => ({
|
||||
image: `${API_BASE}${ev.imageUrl}`,
|
||||
title: ev.title,
|
||||
date: ev.date,
|
||||
description: ev.description
|
||||
}));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch events:', error);
|
||||
}
|
||||
];
|
||||
|
||||
// Fetch gallery images from backend API
|
||||
let images = [];
|
||||
try {
|
||||
const galleryResponse = await fetch(`${API_BASE}/api/gallery/public`);
|
||||
if (galleryResponse.ok) {
|
||||
const galleryData = await galleryResponse.json();
|
||||
images = (galleryData.images || []).map((img: any) => ({
|
||||
src: `${API_BASE}${img.imageUrl}`,
|
||||
alt: img.altText
|
||||
}));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch gallery:', error);
|
||||
}
|
||||
const images = [
|
||||
{ src: "/static/images/gallery/miyma9zc-8he1di.webp", alt: "Schwarzes bild" }
|
||||
];
|
||||
---
|
||||
|
||||
<Layout>
|
||||
|
||||
Reference in New Issue
Block a user