import { useEffect, useState } from 'react' import movieApi from '../apis/movie.api.js' import catchErrors from "../utils/catchErrors.js" const Video = ({ movieId }) => { const [videoUrls, setVideoUrls] = useState([]) const [error, setError] = useState("") useEffect(() => { getVideos() }, []) async function getVideos() { try { const data = await movieApi.getVideosfromTM(movieId) setVideoUrls(data) } catch (error) { catchErrors(error, setError) } } return (
{videoUrls.length > 0 ? videoUrls.map(el => (

{el.name}

)) :
예고편 정보가 존재하지 않습니다.
}
) } export default Video