import React from 'react'; import { Formik } from 'formik'; import Menu from '../Components/Menu'; import axios from 'axios'; import 'bootstrap/dist/css/bootstrap.css'; import * as Yup from 'yup'; function Apply() { return (
apply { axios({ method: 'post', url: '/reserves', data: values, }).then(res => { if (res.status === 404) return alert(res.data.error) alert("신청이 완료되었습니다!") }) .catch(err => { alert(err.error) }); setTimeout(() => { setSubmitting(false); }, 400); // finish the cycle in handler }} > {({ errors, touched, handleSubmit, getFieldProps, isSubmitting, }) => (
{touched.date && errors.date ? (
{errors.date}
) : null}
{touched.time && errors.time ? (
{errors.time}
) : null}
{touched.room && errors.room ? (
{errors.room}
) : null}
{touched.reason && errors.reason ? (
{errors.reason}
) : null}
{touched.name && errors.name ? (
{errors.name}
) : null}
{touched.member && errors.member ? (
{errors.member}
) : null}
)}
) } export default Apply