Skip to content
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

add: mission1 #5

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

add: mission1 #5

wants to merge 2 commits into from

Conversation

Juyoung03
Copy link

No description provided.

Copy link
Collaborator

@hhhkdev hhhkdev left a comment

Choose a reason for hiding this comment

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

흠 잡을 곳 없이 3주차 미션을 해내셧네요 수고 많으셧습니다 여기에 적용된 내용들을 복습하며 프로젝트를 만들어가면 더욱 효과적으로 진행할 수 있지 않을까 싶네요

padding : 20px;
}

.App > section {
Copy link
Collaborator

Choose a reason for hiding this comment

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

식별자 간의 관계를 표현하는 것도 좋네요 이런식으로 이용하다보면 css 관계를 빠르게 이해하는데 도움이 될거 같습니당

Comment on lines +7 to +10
const [number, setCount] = useState(0);
const HandleSetCount = (val) => {
setCount(number + val);
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

useState와 핸들 함수를 적절히 이용한 예시 같네요 개인적으로는 아래 Viewer도 따로 구분한게 좋다고 생각합니당

const [isAuthenticated, setIsAuthenticated] = useState(false);
return (
<div>
<BrowserRouter>
Copy link
Collaborator

Choose a reason for hiding this comment

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

BrowserRouter는 여기 말고도, main.jsx에서 App 컴포넌트를 감싸도 이용할 수 있습니당

Comment on lines +7 to +10
const handleLogout = () => {
localStorage.removeItem("authToken");
alert("로그아웃 되었습니다.");
navigate("/");
Copy link
Collaborator

Choose a reason for hiding this comment

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

토큰을 통해 로그아웃까지 처리한게 좋네요 로컬 스토리지를 통해 확실히 토큰을 이해했다는게 느껴집니당

Comment on lines +25 to +42
const handleSubmit = (e) => {
e.preventDefault();

const userFound = Object.values(users).find(
(user) => user.id === idValue && user.pw === pwValue
);

if (userFound) {
alert("로그인 성공");
setIsAuthenticated(true);
localStorage.setItem("authToken", "your_token_here");
navigate("/protected");
}

else {
alert("아이디 또는 비밀번호가 잘못되었습니다.");
}
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

토큰의 개념을 제대로 이용한 사례네여

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