'use client'; import React, { useState } from 'react'; import { getContract } from '@/lib/ethers'; const GetEventImages = () => { const [eventId, setEventId] = useState(null); const [images, setImages] = useState(null); const handleGetImages = async () => { try { const contract = getContract(); if (eventId === null) return; const eventImages = await contract.getEventImages(eventId); setImages(eventImages); } catch (error) { console.error('Error fetching event images:', error); } }; return (

Get Event Images

setEventId(Number(e.target.value))} className="border p-2 mb-2" /> {images && (

Images for Event {eventId}:

{images.length > 0 ? ( images.map((img, index) => (

{img}

{`Event
)) ) : (

No images available for this event.

)}
)}
); }; export default GetEventImages;