Skip to content
Snippets Groups Projects
Commit 71c8936a authored by Gaeon Kim's avatar Gaeon Kim
Browse files

feat: modify_loginpage

parent 39e3a2c0
Branches
No related tags found
No related merge requests found
import React, {useState} from 'react'; import React, {useState} from 'react';
import styles from "./login.module.css" import styles from "./login.module.css"
import { useNavigate } from 'react-router-dom';
const Login=()=>{ const Login=()=>{
const navigate = useNavigate ();
const [id, setId]=useState(''); const [id, setId]=useState('');
const[password, setPassword]=useState(''); const[password, setPassword]=useState('');
const [err, setError] = useState(null);
const[seePassword, setSeePassword]=useState(true); const[seePassword, setSeePassword]=useState(true);
const handleLogin =async()=>{ const handleLogin =async()=>{
...@@ -22,19 +24,19 @@ const Login=()=>{ ...@@ -22,19 +24,19 @@ const Login=()=>{
if (response.status===200){ if (response.status===200){
alert(data); alert(data);
// 응답에서 access-token 추출 // 응답에서 access-token 추출
const accessToken = data['access-token']; // const accessToken = data['access-token'];
// 쿠키에 저장 // 쿠키에 저장
document.cookie = `access-token=${accessToken}; path=/`; // document.cookie = `access-token=${accessToken}; path=/`;
navigate('/api/schedules');
}else if(response.status===400){ }else if(response.status===400){
alert('해당 정보의 유저가 존재하지 않습니다.'); setError('해당 정보의 유저가 존재하지 않습니다.');
} }
else{ else{
console.log("Login failed", data); console.log("Login failed", data);
} }
}catch(error){ }catch(error){
console.log('error during login', error); alert('해당 정보의 유저가 존재하지 않습니다.');
} }
}; };
const seePasswordHandler=()=>{ const seePasswordHandler=()=>{
...@@ -42,8 +44,9 @@ const Login=()=>{ ...@@ -42,8 +44,9 @@ const Login=()=>{
} }
return( return(
<div className={styles.whole}>
<section className={styles.login_container}> <section className={styles.login_container}>
<div className={styles.logo_img}><img src='/planpuzzle_logo.png' height='80px'></img></div> <div className={styles.logo_img}><img src='/logo.png' height='80px'></img></div>
<div className={styles.title}>로그인</div> <div className={styles.title}>로그인</div>
<div className={styles.input_container}> <div className={styles.input_container}>
<div className={styles.input_with_image}> <div className={styles.input_with_image}>
...@@ -64,7 +67,7 @@ const Login=()=>{ ...@@ -64,7 +67,7 @@ const Login=()=>{
value={password} value={password}
placeholder='비밀번호' placeholder='비밀번호'
onChange={(e) => setPassword(e.target.value)} /> onChange={(e) => setPassword(e.target.value)} />
<span className={styles.eye_img}><img src={seePassword ? './eye-off.png' : './eye-on.png'} <span className={styles.eye_img}><img src={seePassword ? './eyeOff.png' : './eyeOn.png'}
alt='비밀번호 가시성 전환' alt='비밀번호 가시성 전환'
height='18px' height='18px'
width='17px' width='17px'
...@@ -81,6 +84,7 @@ const Login=()=>{ ...@@ -81,6 +84,7 @@ const Login=()=>{
<div className={styles.stick}>―――――――――<span className={styles.or}> 또는 </span>―――――――――</div> <div className={styles.stick}>―――――――――<span className={styles.or}> 또는 </span>―――――――――</div>
<div className={styles.gotoJoin}>아직 계정이 없으신가요? <a href="/api/users" className={styles.loginText}>회원가입</a></div> <div className={styles.gotoJoin}>아직 계정이 없으신가요? <a href="/api/users" className={styles.loginText}>회원가입</a></div>
</section> </section>
</div>
); );
} }
export default Login; export default Login;
\ No newline at end of file
...@@ -53,9 +53,10 @@ ...@@ -53,9 +53,10 @@
border: none; border: none;
outline: none; /* 선택 시 나타나는 외곽선 제거 */ outline: none; /* 선택 시 나타나는 외곽선 제거 */
background-color: #F7F8F8; background-color: #F7F8F8;
margin-left: 15px; margin-left: 10%;
margin-top:-10px; margin-top:-4%;
margin-bottom: 2px margin-bottom: 2px;
width: 80%;
} }
.login{ .login{
height: 60px; height: 60px;
...@@ -106,13 +107,9 @@ ...@@ -106,13 +107,9 @@
margin-top: -10spx; margin-top: -10spx;
} }
.input_with_image input:last-child{
margin-left: 10px;
margin-top:-4px;
margin-bottom: 2px
}
body {
.whole {
margin: 0; margin: 0;
padding: 0; padding: 0;
background: url('../../public/login_background1.png') no-repeat fixed; /* 배경 이미지 설정 */ background: url('../../public/login_background1.png') no-repeat fixed; /* 배경 이미지 설정 */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment