Skip to content

Commit

Permalink
Completed
Browse files Browse the repository at this point in the history
  • Loading branch information
jin-co committed Sep 28, 2023
1 parent 4124e8c commit 9509630
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions React/test-housing/src/pages/Listing.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Link, useNavigate, useParams } from 'react-router-dom'
import { getDoc, doc } from 'firebase/firestore'
import { getAuth } from 'firebase/auth'
import { db } from '../firebase.config'
import Spinner from '../components/Spinner'
import { Spinner } from '../components/Spinner'
import shareIcon from '../assets/svg/shareIcon.svg'
// import { MapContainer, Marker, Popup, TileLayer } from 'react-leaflet'
// import SwiperCore, { Navigation, Pagination, Scrollbar, A11y } from 'swiper'
Expand All @@ -25,11 +25,20 @@ export const Listing = () => {
useEffect(() => {
const fetchListing = async () => {
console.log(params.listingId)
// const docRef = doc(db, 'listings', params.listingId)

const docRef = doc(db, 'listings', params.listingId)
const docSnap = await getDoc(docRef)
if (docSnap.exists()) {
setListing(docSnap.data())
setLoading(false)
}
}

fetchListing()
}, [])

if (loading) {
return <Spinner />
}

return (
<main>
Expand Down

0 comments on commit 9509630

Please sign in to comment.