import axios from 'axios' 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, cinema:"", selectedTheater: "1", time: "2021/07/21 10:00" }) const [cinemaInfo, setCinemaInfo] = useState({}) const [movieInfo, setMovieInfo] = useState() useEffect(() => { getCinemaInfo() }, []) useEffect(() => { getMovieInfo() }, [ticketInfo]) async function getMovieInfo() { try { const data = await movieApi.getMovieInfofromTM(ticketInfo.movieId) setMovieInfo(data) } catch (error) { console.log(error) } } async function getCinemaInfo() { try { const response = await axios.get('/api/info/cinema') console.log(response.data) setCinemaInfo(response.data) } catch (error) { console.log(error) } } return (