-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ 4주차 기본/심화/생각 과제 ]🍁 로그인/회원가입 #11
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
과제하느라 고생 많아따!!! styled-component 적용해서 쓴거 너무 잘했따!! 좀 더 많이 알려주고 싶은데 아직 나의 실력이 그러지 못하네잉.. 나도 많이 공부해서 더 많은걸 알려주도록 노력해볼게! 고생해따!
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Vite + React</title> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
별건 아닌데 관련 없는 favicon은 지우고 title도 나중엔 바꿔줬으면 좋겠다...! 내 개인적인 욕심 ㅎㅎ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
웅웅 title도 바꿔주세요
<BrowserRouter> | ||
<Routes> | ||
<Route path="/Login" element={<Login />} /> | ||
<Route path="/SignUp" element={<SignUp />} /> | ||
<Route path="/MyPage/:userId" element={<MyPage />} /> | ||
</Routes> | ||
</BrowserRouter> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Router 야무지게 썼네!! 잘해따잉~👍 근데..... 과제에는 다 소문자였던거 같은데 상관은 없겠지?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
URI 에서는 소문자를 사용하는 컨벤션이 있는 걸로 알고있습니댱
소문자로 바꿔주는 게 좋을 것 같아!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
컴포넌트 폴더에 router 밖에 없는 건가요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
컴포넌트 분리 무조건 해주시!!!길!!
그리고 수빈이 말대로 url 소문자로 바꿔주시용
const [loginUserId, setLoginUserId] = useState(""); | ||
const [loginPassWord, setLoginPassWord] = useState(""); | ||
const navigate = useNavigate(); | ||
const [fail, setFail] = useState(""); | ||
const [open, setOpen] = useState(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이게 맞는지는 모르겠지만..! useState는 useState끼리, useNavigate는 useNavigate끼리 모아서 써주면 더 보기 좋을거 같다..!
const [loginUserId, setLoginUserId] = useState(""); | |
const [loginPassWord, setLoginPassWord] = useState(""); | |
const navigate = useNavigate(); | |
const [fail, setFail] = useState(""); | |
const [open, setOpen] = useState(false); | |
const [loginUserId, setLoginUserId] = useState(""); | |
const [loginPassWord, setLoginPassWord] = useState(""); | |
const [fail, setFail] = useState(""); | |
const [open, setOpen] = useState(false); | |
const navigate = useNavigate(); |
} catch (e) { | ||
setFail(e.response.data.message); | ||
setOpen(true); | ||
setTimeout(() => setOpen(false), 3000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
혹시 요거 setTimeout은 왜 준건지 알려줄 수 있을까?! Toast때문인가?????
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아마 3초 뒤에 모달 사라지는 거 같으,,, @doyn511
<Button type="button" onClick={handleLogin}> | ||
로그인{" "} | ||
</Button> | ||
|
||
<Button type="button" to="/SignUp"> | ||
회원가입{" "} | ||
</Button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
여기서 { " " }
얘넨 뭐야??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
옹 그러게 지워줘도 될 것 같아
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저거 그냥 생기는 쓸데없는 거,,, 라서 지워주셔야 합니다
const Button = styled(Link)` | ||
background-color: black; | ||
color: white; | ||
|
||
margin: 1px; | ||
font-size: 1rem; | ||
|
||
text-decoration: none; | ||
`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
우와 Link도 저렇게 스타일을 줄 수 있구나...! 요건 새롭다!!!
nickName === "" || | ||
isExist == true ? ( | ||
<Button onClick={handleSignUp} disabled> | ||
회원가입{" "} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
요기도 알 수 없는 { " " }
있다!
<section> | ||
비밀번호 | ||
<input | ||
type="text" | ||
placeholder="비밀번호를 입력해주세요" | ||
value={passWord} | ||
onChange={(e) => setPassWord(e.target.value)} | ||
/> | ||
</section> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
근데 비밀번호 확인 input은 없어도 되나?!!?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생했어 !! 뭔가 이제 리액트가 좀 익숙해진게 느껴지네용 🤓
<Button type="button" onClick={handleLogin}> | ||
로그인{" "} | ||
</Button> | ||
|
||
<Button type="button" to="/SignUp"> | ||
회원가입{" "} | ||
</Button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
옹 그러게 지워줘도 될 것 같아
<BrowserRouter> | ||
<Routes> | ||
<Route path="/Login" element={<Login />} /> | ||
<Route path="/SignUp" element={<SignUp />} /> | ||
<Route path="/MyPage/:userId" element={<MyPage />} /> | ||
</Routes> | ||
</BrowserRouter> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
URI 에서는 소문자를 사용하는 컨벤션이 있는 걸로 알고있습니댱
소문자로 바꿔주는 게 좋을 것 같아!
import.meta.env.VITE_BASE_URL | ||
}/api/v1/members/check?username=${userId}` | ||
); | ||
setIsExist(idChecker.data.isExist); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
상수화 해주는 것도 좋을 것 같아!
나는 요로케 했어
export const CHECK = {
NOT_CHECKED: 0,
EXIST: 1,
NOT_EXIST: 2,
};
{userId === "" || | ||
passWord === "" || | ||
nickName === "" || | ||
isExist == true ? ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
=== 로 수정해주장!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
로직 상으로는 너무너무 좋아요! 물론, reducer를 사용해보는 부분이나 함수를 분리하거나 그런 부분도 있지만 그건 일차적으로 미루고 일단 기능이 돌아가게 했다는게 너무 고생하신 것 같습니다. 다만, 컴포넌트들이 전혀 분리되어 있지 않는다는게 너무 아쉬운데,
컴포넌트 폴더가 있으니 당연히 분리를 해야겠죠?
그리고 사실 페이지 컴포넌트에서 모든 컴포넌트를 만들고 스타일링해서 렌더링하는 건, 하나의 컴포넌트가 하나의 역할을 해야하는 최적화 규칙과는 어긋난다고 생각해요!
최대한 컴포넌트를 잘게 쪼개주시고, 과제 해봐서 아시겠지만 계속 반복되는 컴포넌트가 있죠? 걔네 스타일 컴포넌트까지 해서, 하나의 컴포넌트로 묶어서 불러오면서 props로 조건이나 이벤트함수를 처리하는 부분을 연습하면 좋을것 같아요!
그래도 과제 끝까지 하는거 너무 수고하셨고, 좀더 컴포넌트 분리에 있어서 고민해보는게 좋을 것 같습니다! 모르겠으면 물어바~
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Vite + React</title> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
웅웅 title도 바꿔주세요
<BrowserRouter> | ||
<Routes> | ||
<Route path="/Login" element={<Login />} /> | ||
<Route path="/SignUp" element={<SignUp />} /> | ||
<Route path="/MyPage/:userId" element={<MyPage />} /> | ||
</Routes> | ||
</BrowserRouter> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
컴포넌트 폴더에 router 밖에 없는 건가요?
<BrowserRouter> | ||
<Routes> | ||
<Route path="/Login" element={<Login />} /> | ||
<Route path="/SignUp" element={<SignUp />} /> | ||
<Route path="/MyPage/:userId" element={<MyPage />} /> | ||
</Routes> | ||
</BrowserRouter> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
컴포넌트 분리 무조건 해주시!!!길!!
그리고 수빈이 말대로 url 소문자로 바꿔주시용
</Container> | ||
|
||
{open && | ||
createPortal(<Toast>{fail}</Toast>, document.getElementById("toast"))} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오 심화과제까지 하는 똑또기!!
</head> | ||
<body> | ||
<div id="root"></div> | ||
<div id="toast"></div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
toast 해주었네요!
<Container> | ||
<h1>SingUp</h1> | ||
<section> | ||
ID{" "} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
지워주세요!
}; | ||
|
||
return ( | ||
<Container> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
나중엔 다 styled-component랑 theme을 이용해 보시길,,,
/> | ||
<Button | ||
onClick={idCheck} | ||
className={ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
className말고 styled-component props를 이용한 조건부 렌더링으로 수정해주세요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
</section> | ||
<section> | ||
비밀번호 | ||
<input |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
input이 겹치니까 나중에는 하나의 컴포넌트로 분리하는 게 좋을 걳 같아요
중복체크 | ||
</Button> | ||
</section> | ||
<section> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
section말고 article로 하는게 좀더 시멘틱할 것 같습니다
🌱 기본 조건
.env
파일 사용하기🧩 기본 과제
[ 로그인 페이지 ]
/mypage/:userId
로 넘어갑니다. (여기서userId
는 로그인 성공시 반환 받은 사용자의 id)/signup
으로 이동합니다.[ 회원가입 페이지 ]
중복체크 버튼
회원가입 버튼
/login
으로 이동합니다.[ 마이 페이지 ]
/mypage/:userId
의 userId를 이용해 회원 정보를 조회합니다.🌠 심화 과제
[ 로그인 페이지 ]
createPortal
을 이용합니다.[ 회원가입 페이지 ]
비밀번호 확인
중복체크
생각과제
💎 PR Point
Get, Post를 통한 HTTP method를 사용하고
useParams, useEffect, useState 등의 Hook을 사용했습니다.
🥺 소요 시간, 어려웠던 점
4d
🌈 구현 결과물
_2023_11_17_22_19_40_318.mp4