"use client" import React, { useEffect, useState } from 'react' import MeetingEventSelection from '../_components/MeetingEventSelection' import { collection, doc, getDoc, getDocs, getFirestore, query, where } from 'firebase/firestore' import { app } from '@/config/FirebaseConfig' const ShareMeetingEvent = ({params}) => { const [businessInfo, setBusinessInfo] = useState(); const [meetingEventInfo, setMeetingEventInfo] = useState(); const [loading, setLoading] = useState(false); const db = getFirestore(app); //get information const getMeetingEventDetail = async () => { setLoading(true) const q = query(collection(db, 'Business'), where('businessName', '==', params.business)); const docSnap = await getDocs(q); docSnap.forEach((doc) => { setBusinessInfo(doc.data()) }); const docRef = doc(db, 'MeetingEvent', params.meetingEventId); const result = await getDoc(docRef); setMeetingEventInfo(result.data()); setLoading(false) } useEffect(() => { params && getMeetingEventDetail(); }, [params]) return (
) } export default ShareMeetingEvent