import { useEffect, useState } from 'react' import movieApi from '../apis/movie.api.js' import catchErrors from '../utils/catchErrors.js' const Collection = ({ TMDB_TopRated_Data }) => { const [videoUrls, setVideoUrls] = useState([]) const [error, setError] = useState("") useEffect(() => { if (TMDB_TopRated_Data.length > 0) { console.log("야이쒸===", TMDB_TopRated_Data) getVideos() } }, [TMDB_TopRated_Data]) async function getVideos() { try { const data = await movieApi.getVideosfromTM(TMDB_TopRated_Data[0].id) setVideoUrls(data) } catch (error) { // catchErrors(error, setError) console.log(error) } } return ( <>