Change "books/books" to "movie/movies"
This commit is contained in:
parent
bb31d1eca8
commit
3cede41dbe
|
@ -118,7 +118,7 @@ const signIn = (email, password) => {
|
||||||
|
|
||||||
// function to get data
|
// function to get data
|
||||||
const readData = async () => {
|
const readData = async () => {
|
||||||
const querySnapshot = await getDocs( collection(FBdb, "books") )
|
const querySnapshot = await getDocs( collection(FBdb, "movies") )
|
||||||
let listdata = []
|
let listdata = []
|
||||||
querySnapshot.forEach( (doc) => {
|
querySnapshot.forEach( (doc) => {
|
||||||
let item = doc.data()
|
let item = doc.data()
|
||||||
|
|
|
@ -10,7 +10,7 @@ export function ItemImage ( props ) {
|
||||||
|
|
||||||
useEffect( () => {
|
useEffect( () => {
|
||||||
if( props.source ) {
|
if( props.source ) {
|
||||||
const imgref = ref( storage, `book_covers/${props.source}`)
|
const imgref = ref( storage, `movie_covers/${props.source}`)
|
||||||
getDownloadURL( imgref )
|
getDownloadURL( imgref )
|
||||||
.then( (url) => setImage(url) )
|
.then( (url) => setImage(url) )
|
||||||
.catch( err => console.log(err) )
|
.catch( err => console.log(err) )
|
||||||
|
|
|
@ -8,22 +8,22 @@ import { useState, useEffect, useContext } from "react"
|
||||||
import { ItemImage } from "../components/ItemImage"
|
import { ItemImage } from "../components/ItemImage"
|
||||||
|
|
||||||
export function Home(props) {
|
export function Home(props) {
|
||||||
const [books,setBooks] = useState([])
|
const [movies,setMovies] = useState([])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log( props.items )
|
console.log( props.items )
|
||||||
setBooks( props.items )
|
setMovies( props.items )
|
||||||
}, [props.items])
|
}, [props.items])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const ItemCards = books.map( ( book, itemkey ) => {
|
const ItemCards = movies.map( ( movie, itemkey ) => {
|
||||||
return(
|
return(
|
||||||
<Col md={4}>
|
<Col md={4}>
|
||||||
<Card key={itemkey}>
|
<Card key={itemkey}>
|
||||||
<ItemImage source={ book.cover_image} />
|
<ItemImage source={ movie.cover_image} />
|
||||||
<Card.Body>
|
<Card.Body>
|
||||||
<Card.Title>{ book.title }</Card.Title>
|
<Card.Title>{ movie.title }</Card.Title>
|
||||||
</Card.Body>
|
</Card.Body>
|
||||||
</Card>
|
</Card>
|
||||||
</Col>
|
</Col>
|
||||||
|
|
Loading…
Reference in New Issue