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

[#110] Feat: 로그아웃 기능 구현 #116

Merged
merged 7 commits into from
Mar 10, 2024
Merged

[#110] Feat: 로그아웃 기능 구현 #116

merged 7 commits into from
Mar 10, 2024

Conversation

choi-ik
Copy link
Contributor

@choi-ik choi-ik commented Mar 7, 2024

📝 작업 내용

로그아웃 기능을 구현하였습니다.

  • 로그아웃 버튼 클릭 시 로컬 스토리지에 저장되어있는 액세스/리프레시 토큰을 삭제 한 뒤 메인 페이지로 이동시켜주었습니다.
  • 드랍 다운 메뉴의 로그인/로그아웃을 토글로 구현하였습니다.

테스트 해보시려면 core.ts의 요청을 가로채는 부분에서 상수로 등록한 �ACCESS_TOKENgetLocalStorage에 넣어주시고, #85 의 로그인 모달에 수정된 부분을 현재 PR의 로그인 모달에 넣어주시면 됩니다!

📷 스크린샷 (선택)

💬 리뷰 요구사항(선택)

📍 기타 (선택)

close #110

@choi-ik choi-ik added the ✨ Feature 새로운 기능 추가 label Mar 7, 2024
@choi-ik choi-ik self-assigned this Mar 7, 2024
@choi-ik choi-ik linked an issue Mar 7, 2024 that may be closed by this pull request
Copy link

vercel bot commented Mar 7, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
zzalmyu-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 10, 2024 7:10am

const navigate = useNavigate();

const { mutate, ...rest } = useMutation({
mutationFn: () => patchLogOut(),
Copy link
Contributor

Choose a reason for hiding this comment

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

토큰이라 로그가웃 요청이 따로 필요하지 않을 거 같은데 api가 있는 이유가 있을까요? 한 번 발행한 토큰은 서버에서 만료시켜줄 수 없어서 서버에서 어떤 처리를 하는 지 궁금하네요

Copy link
Contributor Author

Choose a reason for hiding this comment

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

안그래도 해당 부분 궁금해서 수진님께 여쭤봤었는데, 서버에서는 db에 저장되어 있는 리프레시토큰을 삭제합니다. 그리고 accessToken은 db에 blackout로 처리해 저장해서 로그아웃한 accessToken으로 접근이 불가능하도록 막았습니다 라고 하셨습니다!

Copy link
Contributor

Choose a reason for hiding this comment

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

알겠습니다! 감사합니다 : )

navigate({ to: "/" });
},
onError: (error) => {
console.log(error);
Copy link
Contributor

Choose a reason for hiding this comment

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

에러 로깅할때는 error trace 가능한 console.error 사용해주시면 좋을 것 같습니당

Copy link
Contributor Author

Choose a reason for hiding this comment

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

넵 알겠습니다~!

const navigate = useNavigate();

const { mutate, ...rest } = useMutation({
mutationFn: () => patchLogOut(),
Copy link
Contributor

Choose a reason for hiding this comment

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

넘겨줄 파라미터 없어서 화살표 함수는 제거하고 patchLogout()만 작성해도 될 것 같네요?

Copy link
Contributor

@yjc2021 yjc2021 left a comment

Choose a reason for hiding this comment

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

LGTM 🦕

Copy link
Contributor

@hyeonjinan096 hyeonjinan096 left a comment

Choose a reason for hiding this comment

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

LGTMLGTMLGTM

@choi-ik choi-ik merged commit 2319955 into main Mar 10, 2024
3 checks passed
@choi-ik choi-ik deleted the #110/feature/logout branch March 10, 2024 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Feature 새로운 기능 추가
Projects
None yet
Development

Successfully merging this pull request may close these issues.

로그아웃 기능 구현
4 participants