import React, { useState } from 'react'; import { Field, Formik } from 'formik'; import * as Yup from 'yup'; import axios from 'axios'; import { Link, Redirect } from 'react-router-dom'; import styled from 'styled-components'; import { Col, Container, Navbar, Button } from 'react-bootstrap'; const Menu = styled(Navbar)` background-color: #7B031D; a { color : white; } ` const Wow = styled.div` height: 90vh; & #reCheck::after { content: '비밀번호를 다시 입력하세요'; } & #reCheck:not(.right) { content: '비밀번호가 일치하지 않습니다.'; color: red; } ` function Signup() { const [state, setState] = useState(false); const [checkPw, setCheckPw] = useState(true); if (state) { return ; } return (
회원가입 { axios({ method: 'post', url: '/users', data: values, }).then(res => { if (res.status === 404) return alert(res.data.error) alert("회원가입이 완료되었습니다!") setState(true); }) .catch(err => { alert(err.error) }); setTimeout(() => { setSubmitting(false); }, 400); // finish the cycle in handler }} > {({ errors, touched, handleSubmit, getFieldProps, // contain values, handleChange, handleBlur isSubmitting, }) => (
이름을 입력하세요
학번을 입력하세요
비밀번호를 입력하세요(8자리 이상)
{touched.password2 && errors.password2 ? setCheckPw(false) : null}
답변을 입력해주세요.
)}
); } export default Signup