Skip to content

Conversation

@kangtayie
Copy link
Contributor

  1. axios로 로그인, 회원가입 요청 처리 구현
  2. jsx 파일들 -> tsx 로 바꾸고 필요한 수정사항들 수정
  3. 아이디 로그인 중복 방지 구현
  4. 서버에 오류가 발생할 때 오류 메세지 출력.

@kangtayie kangtayie self-assigned this May 20, 2025
Copy link
Member

@yezzan9 yezzan9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6주차 과제도 수고하셨습니다!!
몇가지 코멘트 남겨드렸으니 확인 후 태이님 생각도 공유해주세요🙌

Comment on lines +29 to +57
function Home(){
const navigate =useNavigate();

const buttonStyle = {
width: "200px",
padding: "10px 0",
margin: "20px auto",
display: "block",
backgroundColor: "#ddd",
border: "none",
borderRadius: "30px",
fontSize: "1.1rem",
fontWeight: "600",
};

const titleStyle = {
fontSize: "2rem",
fontWeight: "700",
marginBottom: "40px",
};

return(
<div style={{textAlign:"center"}}>
<h1 style={titleStyle}>Tayie's TODO</h1>
<button style={buttonStyle} onClick={() => navigate("/login")}>로그인</button>
<button style={buttonStyle} onClick={() => navigate("/signup")}>회원가입</button>
</div>
);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 부분도 다른 페이지처럼 별도의 파일로 분리해주세요!

Comment on lines +16 to +31
const StyledInput = styled.input`
width: 500px;
padding: 14px;
border-radius: 0px;
margin-bottom: 8px;
`

const StyledButton = styled.button`
background-color: black;
color: white;
width: 532px;
padding: 9px;
border: none;
border-radius: 0px;
margin-bottom: 8px;
`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Input과 Button은 기존에 구현했던 컴포넌트를 재사용하도록 수정하면 좋을 것 같아요 !!

const StyledButton = styled(Button)`
// 이하 생략

이렇게 하면 Button태그에 정의되어있는 스타일을 그대로 상속받은 채 추가로 스타일을 설정할 수 있어요 !!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

해당 파일에서 styled-components를 사용하지 않고 스타일 객체를 사용하신 이유가 있을까용?-?
스타일 형식은 하나로 통일하는 것이 좋을 것 같아요 !!

Comment on lines 15 to 22
const res = await axios.get<{ username: string}[]>(`http://localhost:3000/users?username=${username}`);
console.log("GET /users?username= 응답:", res.data);

if(res.data.length > 0){
setErrorMsg("이미 존재하는 아이디입니다!");
return;
}
await axios.post("http://localhost:3000/users", {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

현재 http://localhost:3000까지 포함해서 작성해주셨는데, 이렇게 로컬 주소가 하드코딩되어 있으면 실제 서비스 배포 시에도 로컬 서버로 요청하게 되어 문제가 발생할 수 있어요💦

앞의 로컬호스트 도메인을 제거하고 도메인 뒷부분만 /users?username=${username} 이렇게 작성해주시면 도메인이 달라져도 의도하신 대로 동작하게 할 수 있어요 !!

예를 들어 배포 도메인이 leets.com인 경우에
배포 사이트에서는 leets.com/users?username=${username}로, 로컬에서 테스트할 때는 localhost:3000/users?username=${username}로 동작한답니다🙌

navigate("/login");
} catch(error){
console.error("회원가입 오류: error");
setErrorMsg("**서버 오류가 발생했습니다!** ");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이렇게 했을 때 마크다운 문법이 적용되나용..?!

@yezzan9
Copy link
Member

yezzan9 commented May 22, 2025

그리고 PR템플릿을 이용하여 구현한 부분에 대해 좀 더 자세히 작성해주시면 좋을 것 같아요 👀
다른 분들이 작성하신 PR을 참고하시면 충분히 작성하실 수 있을 거예요 !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants