Commit f53b58dc authored by 이재연's avatar 이재연
Browse files

로그아웃 완료

parent ae9446cf
...@@ -23,6 +23,7 @@ function Login() { ...@@ -23,6 +23,7 @@ function Login() {
setUser({ ...user, [name]: value }) setUser({ ...user, [name]: value })
} }
async function handleSubmit(event) { async function handleSubmit(event) {
event.preventDefault() event.preventDefault()
const form = event.currentTarget; const form = event.currentTarget;
...@@ -39,71 +40,66 @@ function Login() { ...@@ -39,71 +40,66 @@ function Login() {
} catch (error) { } catch (error) {
catchErrors(error, setError) catchErrors(error, setError)
} }
} }
if (success) { if (success) {
alert('로그인 되었습니다.') alert('로그인 되었습니다.')
return <Redirect to='/' /> window.location.href='/'
} }
return ( return (
<div> <Container className="my-5">
<Row className="justify-content-center">
<Container className="my-5"> <Col md={5} xs={10} className="border" style={{ background: '#F7F3F3' }}>
<Row className="justify-content-center"> <h3 className="text-center mt-5">Login</h3>
<Col md={5} xs={10} className="border" style={{ background: '#F7F3F3' }}> {error && <Alert variant='danger'>
<h3 className="text-center mt-5">Login</h3> {error}
{error && <Alert variant='danger'> </Alert>}
{error} <Form noValidate validated={validated}
</Alert>} onSubmit={handleSubmit}
<Form noValidate validated={validated} className="p-5">
onSubmit={handleSubmit} <Form.Group controlId="formBasicId">
className="p-5"> <Form.Row>
<Form.Group controlId="formBasicId"> <Col sm={4} xs={6} as={Form.Label} for="id"> 아이디</Col>
<Form.Row> <Col sm={8} xs={12} as={Form.Control}
<Col sm={4} xs={6} as={Form.Label} for="id"> 아이디</Col> required
<Col sm={8} xs={12} as={Form.Control} type="text"
required name="id"
type="text" placeholder="ID"
name="id" value={user.id}
placeholder="ID" onChange={handleChange}
value={user.id} style={{ width: '160px' }}>
onChange={handleChange} </Col>
style={{ width: '160px' }}> <Form.Control.Feedback className="text-center" type="invalid"> 아이디를 입력하세요.</Form.Control.Feedback>
</Col> </Form.Row>
<Form.Control.Feedback className="text-center" type="invalid"> 아이디를 입력하세요.</Form.Control.Feedback> </Form.Group>
</Form.Row>
</Form.Group>
<Form.Group controlId="formBasicPassword"> <Form.Group controlId="formBasicPassword">
<Form.Row> <Form.Row>
<Col sm={4} xs={6} as={Form.Label} for="password">비밀번호</Col> <Col sm={4} xs={6} as={Form.Label} for="password">비밀번호</Col>
<Col sm={8} xs={12} as={Form.Control} <Col sm={8} xs={12} as={Form.Control}
type="password" type="password"
name="password" name="password"
value={user.password} value={user.password}
placeholder="Password" placeholder="Password"
onChange={handleChange} onChange={handleChange}
style={{ width: '160px' }} style={{ width: '160px' }}
required /> required />
<Form.Control.Feedback className="text-center" type="invalid"> <Form.Control.Feedback className="text-center" type="invalid">
비밀번호를 입력하세요. 비밀번호를 입력하세요.
</Form.Control.Feedback> </Form.Control.Feedback>
</Form.Row> </Form.Row>
</Form.Group> </Form.Group>
<Button style={{ background: '#91877F', borderColor: '#91877F' }} type="submit" block>Login</Button> <Button style={{ background: '#91877F', borderColor: '#91877F' }} type="submit" block>Login</Button>
<div className="loginLine"> <div className="loginLine">
<Link to="/signup" style={{ color: '#91877F' }}>회원이 아니십니까?</Link> <Link to="/signup" style={{ color: '#91877F' }}>회원이 아니십니까?</Link>
</div> </div>
</Form> </Form>
</Col> </Col>
</Row> </Row>
</Container> </Container>
</div>
) )
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment