import { useState, useEffect } from 'react' import { Link } from 'react-router-dom' import movieApi from '../apis/movie.api.js' import TicketingMovie from "../components/TicketingMovie/TicketingMovie.js" import TicketingTheater from "../components/TicketingTheater/TicketingTheater.js" import TicketingTimeTable from "../components/TicketingTimeTable/TicketingTimeTable.js" const TicketingPage = ({ location }) => { const [ticketInfo, setTicketInfo] = useState({ ...location.state, theater:"", selectedCinemaNum: 3, time: "2021/07/21 10:00" }) const [theaterInfo, setTheaterInfo] = useState({ theater: ["Butter Studio 조치원"], cinemaNum: [1, 2, 3, 4] }) const [movieInfo, setMovieInfo] = useState() useEffect(() => { getMovieInfo() }, [ticketInfo]) async function getMovieInfo() { try { const data = await movieApi.getMovieInfofromTM(ticketInfo.movieId) setMovieInfo(data) } catch (error) { console.log(error) } } return (
{console.log(ticketInfo)}

영화

극장

시간표

{movieInfo ? 영화포스터 :
영화선택
}
극장선택
{movieInfo && ticketInfo.theater ?
  • 영화: {movieInfo.title}
  • 극장: {ticketInfo.theater}
  • 일시: {ticketInfo.time}
  • 상영관: {ticketInfo.selectedCinemaNum}
:
}
좌석선택
{movieInfo && ticketInfo.theater ? 예매하기 : 예매하기 }
) } export default TicketingPage