import React, { useState, useEffect, useRef } from 'react'; import styled from 'styled-components'; import { Link, Redirect } from 'react-router-dom'; import { Formik } from 'formik'; import * as Yup from 'yup'; import axios from 'axios'; import 'bootstrap/dist/css/bootstrap.css'; import Logo from '../icon.png'; const Asd = styled.div` background-color: #7B031D; &.web { display : flex; align-items: center; } &.mobile { height : 20vh; display : flex; } & .mob-head { display: flex; flex-direction: row; height : 100%; width: 100%; justify-content: center; align-content: center; } & .mob-img { max-width:100%; max-height:100%; } ` const Asdf = styled.div` background-color: rgb(239, 218, 200); a { color : #7B031D; } &.mob-formik { height : 80vh; width: 100%; padding: 0; display: flex; justify-content: center; align-items: center; } &.web-formik { height: 100%; display: flex; align-items: center; justify-content: center; } & .mobb { height: 30vh; display: flex; flex-direction: column; justify-content: space-around; } & .qwer { display: flex; justify-content: space-between; height: 12vh; width: 30vw; margin-bottom: 25px; } & .web-input-form { width: 80%; justify-content: space-between; align-content: space-around; display: flex; flex-direction: column; } & .mob-input-form { } ` function Login() { const [state, setState] = useState(false); const [mobile, setMobile] = useState(false); useEffect(() => { if (window.innerWidth < 960) { setMobile(true) } else { setMobile(false) } }, []); if (state) { return ; } return (

고려대학교
대관 서비스

{ axios({ method: 'post', url: '/login', data: values, }).then(res => { if (res.status === 404) return alert(res.data.error) localStorage.setItem('token', res.data.token); localStorage.setItem('id', res.data.users._id); 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, }) => (
비밀번호를 잊으셨나요?
회원이 아니신가요?
)}
) } export default Login