import React, { useState, useEffect } from 'react'; import { useParams } from 'react-router-dom'; import Navbar from '../ComponentUtils/Headers/Navbar'; import Footer from '../ComponentUtils/Footer'; import ImageGalleryCard from '../ComponentUtils/ImageGalleryCard'; import ImageGallery from '../ComponentUtils/ImageGallery'; import { apiFetch } from '../../Utils/apiFetch'; const PublicGroupImagesPage = () => { const { groupId } = useParams(); const [group, setGroup] = useState(null); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); useEffect(() => { loadGroup(); // eslint-disable-next-line react-hooks/exhaustive-deps }, [groupId]); const loadGroup = async () => { try { setLoading(true); // Public endpoint (no moderation controls) const res = await apiFetch(`/api/groups/${groupId}`); if (!res.ok) throw new Error('Nicht gefunden'); const data = await res.json(); setGroup(data); } catch (e) { setError('Fehler beim Laden der Gruppe'); } finally { setLoading(false); } }; if (loading) return