This repository has been archived by the owner on Aug 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
167 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,71 @@ | ||
import React from "react"; | ||
import React, { useState } from "react"; | ||
import { useNavigate } from "react-router-dom"; | ||
import "./SignUp1.css"; | ||
import axios from "axios"; | ||
|
||
function Header() { | ||
return ( | ||
<header> | ||
<div className="line"></div> | ||
<div id="idBox"> | ||
<h1> | ||
로그인을 위해 | ||
<br /> | ||
아이디와 비밀번호를 | ||
<br /> | ||
정확하게 입력해주세요! | ||
</h1> | ||
</div> | ||
function Login() { | ||
const navigate = useNavigate(); | ||
const [loginData, setLoginData] = useState({ | ||
id: "", | ||
password: "", | ||
}); | ||
|
||
<input id="inputId" type="text" placeholder="아이디 입력" /> | ||
<br /> | ||
<input id="inputPwd" type="text" placeholder="비밀번호 확인 입력" /> | ||
</header> | ||
); | ||
} | ||
const handleInputChange = (e) => { | ||
setLoginData({ ...loginData, [e.target.name]: e.target.value }); | ||
}; | ||
|
||
function Button() { | ||
const navigate = useNavigate(); | ||
const handleLogin = async () => { | ||
try { | ||
const response = await axios.post("20.41.66.225", loginData); | ||
|
||
return ( | ||
<div className="btns"> | ||
<input id="prevBtn" type="button" onClick={() => navigate(-1)} /> | ||
<input id="login" type="button" value="로그인" /> | ||
<input id="helpBtn" type="button" /> | ||
</div> | ||
); | ||
} | ||
if (response.status === 200) { | ||
navigate("/Main"); | ||
} else { | ||
console.error("Login failed"); | ||
} | ||
} catch (error) { | ||
console.error("There was an error during the login process:", error); | ||
} | ||
}; | ||
|
||
function SignUp2() { | ||
return ( | ||
<div> | ||
<Header /> | ||
<Button /> | ||
<header> | ||
<div className="line"></div> | ||
<div id="idBox"> | ||
<h1> | ||
로그인을 위해 | ||
<br /> | ||
아이디와 비밀번호를 | ||
<br /> | ||
정확하게 입력해주세요! | ||
</h1> | ||
</div> | ||
<input | ||
id="inputId" | ||
type="text" | ||
name="id" | ||
placeholder="아이디 입력" | ||
value={loginData.id} | ||
onChange={handleInputChange} | ||
/> | ||
<br /> | ||
<input | ||
id="inputPwd" | ||
type="password" | ||
name="password" | ||
placeholder="비밀번호 입력" | ||
value={loginData.password} | ||
onChange={handleInputChange} | ||
/> | ||
</header> | ||
<div className="btns"> | ||
<button id="prevBtn" onClick={() => navigate(-1)} aria-label="Previous" /> | ||
<button id="login" onClick={handleLogin} aria-label="Login">로그인</button> | ||
<button id="helpBtn" aria-label="Help" /> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default SignUp2; | ||
export default Login; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.