'use client'; import React, { useEffect, useState } from 'react'; import { useParams } from 'next/navigation'; import Header from '../../../components/custom/header'; import Footer from '../../../components/custom/footer'; import EventDescription from '../../../components/custom/EventDescription'; import { fetchEventDetails } from '@/lib/fetchEventDetails'; const ListingPage: React.FC = () => { const { eventId } = useParams(); const [eventDetails, setEventDetails] = useState(null); const [eventNotFound, setEventNotFound] = useState(false); useEffect(() => { const getEventDetails = async () => { if (eventId) { const details = await fetchEventDetails({ eventID: Number(eventId), toast: ({ title, variant }: any) => {alert(title);}}); console.log(details) setEventDetails(details); } }; getEventDetails().catch((err) => { setEventNotFound(true); console.log(eventNotFound); }); }, [eventId]); return ( <>
{eventNotFound ?

Event not found

: (eventDetails ? ( ) : (

Loading...

)) }
); }; export default ListingPage;