import axios from 'axios' import { useEffect, useState } from 'react' import Kakaopay from '../components/Kakaopay' import { useAuth } from '../context/auth_context' import catchErrors from '../utils/catchErrors' const Payment = ({ location }) => { const [ticketInfo, setTicketInfo] = useState({ ...location.state }) const [error, setError] = useState("") const [userInfo, setUserInfo] = useState() const { user } = useAuth() useEffect(() => { getUserInfo() }, []) async function getUserInfo() { try { const response = await axios.post(`/api/auth/getuserinfo`, { id: user.id }) setUserInfo(response.data) } catch (error) { catchErrors(error, setError) } } async function SendMail(e) { try { const response = await axios.post('/api/email/send', { ...ticketInfo, ...userInfo }) console.log(response.data) } catch (error) { console.log(error) } } return (
{console.log(ticketInfo)} {console.log(userInfo)}

결제하기

{user?.id > 0 ?
회원정보
:
비회원예매 정보입력
}
결제방법
영화포스터
{ticketInfo.title}
{ticketInfo.cinema}
{ticketInfo.time}
{ticketInfo.selectedTheater}관 {ticketInfo.selectedSeats}
청소년: {ticketInfo.teenager}명
성인: {ticketInfo.adult}명
경로우대: {ticketInfo.elderly}명
총 결제금액: {ticketInfo.teenager * 7000 + ticketInfo.adult * 8000 + ticketInfo.elderly * 6000}
) } export default Payment