import React from 'react'; import { useSearchParams } from 'react-router-dom'; import { deletePhoto, featurePhoto, getEventPhotos, unfeaturePhoto } from '../api'; import { Button } from '@/components/ui/button'; export default function EventPhotosPage() { const [sp] = useSearchParams(); const id = Number(sp.get('id')); const [rows, setRows] = React.useState([]); const [loading, setLoading] = React.useState(true); async function load() { setLoading(true); try { setRows(await getEventPhotos(id)); } finally { setLoading(false); } } React.useEffect(() => { load(); }, [id]); async function onFeature(p: any) { await featurePhoto(p.id); load(); } async function onUnfeature(p: any) { await unfeaturePhoto(p.id); load(); } async function onDelete(p: any) { await deletePhoto(p.id); load(); } return (

Fotos moderieren

{loading &&
Lade…
}
{rows.map((p) => (
❤ {p.likes_count}
{p.is_featured ? ( ) : ( )}
))}
); }