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 (