import { useEffect, useState } from 'react'; import { Head } from '@inertiajs/react'; import AppLayout from '@/layouts/AppLayout'; import styles from './Gallery.module.css'; import { ActionButtons } from '@/components/ActionButtons/ActionButtons'; import Header from '@/components/Header/Header'; import Footer from '@/components/Footer/Footer'; interface Photo { id: number; sort_order: number; name: string; description: string | null; photo: string; created_at: string; updated_at: string; } interface PhotosResponse { status: string; data: Photo[]; } export default function Gallery() { const [photos, setPhotos] = useState([]); const [loading, setLoading] = useState(true); useEffect(() => { fetch('/api/photos') .then(res => res.json()) .then((response: PhotosResponse) => { if (response.status === 'success') { setPhotos(response.data); } setLoading(false); }) .catch(error => { console.error('Error fetching photos:', error); setLoading(false); }); }, []); if (loading) { return ( <> ); } return (

Poniżej znajdziesz kilka zdjęć naszej przepysznej pizzy.

{photos.map((photo, index) => ( {photo.description ))}
); }