import React, { useEffect, useState } from 'react'; import { Link, useHistory } from 'react-router-dom'; import { LoadingButton } from '@material-ui/lab'; import axios from 'axios'; import Alert from '../../../component/alert'; const ChildLogin = () => { const [submit, setSubmit] = useState(false); const [tel, setTel] = useState(''); const [password, setPassword] = useState(''); const [_422errors, set422Errors] = useState({tel: '', password: ''}); const [_400error, set400Error] = useState(null); const handleSubmit = (e) => { e.preventDefault(); setSubmit(true); set422Errors({tel:'', password:''}); const formdata = new FormData(); formdata.append('tel', tel); formdata.append('password', password); axios.post('/api/children/login/', formdata) .then(response => { setSubmit(false) switch(response.data.status_code){ case 200:{ localStorage.setItem("from_login", true); window.location.href = '/c-account/meeting'; break; } case 422: set422Errors(response.data.error_messages); break; case 400: set400Error(response.data.error_message[0]); break; } }) } return (

ログイン

setTel(e.target.value)} autoFocus/> { _422errors.tel && { _422errors.tel } }
setPassword(e.target.value)}/> { _422errors.password && { _422errors.password } }
ログイン
パスワード紛失の方はコチラ
{ _400error && set400Error(null)}>{_400error} }
) } export default ChildLogin;