-
Notifications
You must be signed in to change notification settings - Fork 3
Hotfix/로그인하지 않은 사용자 처리 #89
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
Conversation
|
Caution Review failedThe pull request is closed. Walkthrough이 변경 사항은 Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (3)
src/app/(crew)/crew/detail/[id]/_components/create-gathering.tsx (2)
15-21: 인증 상태에 따른 분기 처리가 잘 구현되었습니다만, 사용자 경험 개선이 필요합니다.현재 구현은 기능적으로는 문제가 없으나, 사용자 경험을 개선할 수 있는 여지가 있습니다.
다음과 같은 개선사항을 고려해보세요:
const handleButtonClick = () => { if (isAuth) { open(); // 로그인 상태일 경우 모달 열기 } else { + // 현재 페이지 URL을 state로 전달하여 로그인 후 돌아올 수 있도록 함 + const returnUrl = window.location.pathname; + router.push(`/login?returnUrl=${encodeURIComponent(returnUrl)}`); - router.push('/login'); // 비로그인 상태일 경우 로그인 페이지로 이동 } };
Line range hint
1-40: 전반적인 에러 처리 보완이 필요합니다.라우팅이나 모달 조작 과정에서 발생할 수 있는 예외 상황에 대한 처리가 누락되어 있습니다.
다음과 같은 에러 처리 로직 추가를 제안드립니다:
const handleButtonClick = async () => { try { if (isAuth) { open(); } else { const returnUrl = window.location.pathname; await router.push(`/login?returnUrl=${encodeURIComponent(returnUrl)}`); } } catch (error) { console.error('페이지 이동 중 오류가 발생했습니다:', error); // 에러 처리 로직 추가 (예: 토스트 메시지 표시) } };src/app/_components/hero/hero-crew.tsx (1)
12-15: 로그아웃 후 홈 페이지 리디렉션 처리가 필요할 수 있습니다.현재 구현은 기본적인 기능은 제공하지만, 사용자 경험 향상을 위해 다음 사항들을 고려해보시기 바랍니다:
- 로그아웃 진행 중임을 사용자에게 알리는 로딩 상태 표시
- 로그아웃 실패 시 에러 처리
다음과 같이 개선해 보시는 것은 어떨까요?
- const handleLogout = () => { - logout(); - router.push('/'); - }; + const handleLogout = async () => { + try { + await logout(); + router.push('/'); + } catch (error) { + console.error('로그아웃 중 오류가 발생했습니다:', error); + // 에러 처리 로직 추가 + } + };
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (3)
src/app/(crew)/crew/detail/[id]/_components/create-gathering.tsx(2 hunks)src/app/_components/hero/hero-crew.tsx(2 hunks)src/components/common/crew-list/crew-card.tsx(1 hunks)
🔇 Additional comments (6)
src/app/(crew)/crew/detail/[id]/_components/create-gathering.tsx (3)
3-3: 필요한 훅들이 적절히 추가되었습니다.
인증 상태 관리와 라우팅을 위한 필수적인 훅들이 잘 import 되었습니다.
Also applies to: 5-5
11-12: 상태 관리 설정이 올바르게 구현되었습니다.
인증 상태와 라우터 객체가 적절하게 초기화되었습니다.
34-37: 버튼 클릭 핸들러가 올바르게 연결되었습니다.
새로운 인증 처리 로직이 버튼에 잘 연결되었습니다.
src/app/_components/hero/hero-crew.tsx (3)
3-3: 필요한 의존성이 올바르게 추가되었습니다.
인증 관련 기능 구현을 위한 필수적인 의존성들이 적절하게 import 되었습니다.
Also applies to: 5-5
9-10: 인증 상태 관리가 적절히 구현되었습니다.
useAuthStore를 통해 인증 상태와 로그아웃 함수를 가져오고, 라우팅을 위한 router 설정이 올바르게 되어있습니다.
33-33: 조건부 라우팅이 적절히 구현되었습니다.
인증 상태에 따라 적절한 페이지로 리디렉션되도록 구현되어 있습니다. 다만, 이 변경사항이 다른 컴포넌트들과 일관성있게 적용되었는지 확인이 필요합니다.
다음 스크립트로 다른 컴포넌트들의 라우팅 처리를 확인해보세요:
✅ Verification successful
조건부 라우팅 구현이 일관성 있게 적용되어 있습니다.
코드베이스 분석 결과:
isAuth상태는useAuthStore를 통해 전역적으로 관리되고 있습니다.- 헤더(
header/presenter.tsx)와 크루 상세 페이지(create-gathering.tsx)에서도 동일한 인증 상태 기반의 조건부 처리가 구현되어 있습니다. - 현재 변경사항은 기존 인증 처리 패턴과 일치합니다.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: 인증 상태에 따른 라우팅 처리 패턴 검색
rg "href=\{.*isAuth.*\}" --type tsx
Length of output: 65
Script:
#!/bin/bash
# Search for conditional routing patterns in React components
rg "href=\{.*\?" --type ts --type tsx -A 2
# Also search for isAuth usage in components
rg "isAuth" --type ts --type tsx -A 2
Length of output: 138
Script:
#!/bin/bash
# Search for conditional routing patterns and isAuth usage in all files
rg "href=\{.*\?"
rg "isAuth" -A 2
Length of output: 4256
| // NOTE: api연결 후 되돌리기 | ||
| // const CREWPAGE = `/crew/detail/${id}`; | ||
| const CREWPAGE = `/crew/detail/1`; |
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.
하드코딩된 ID 값을 원래대로 되돌려주세요.
현재 모든 크루 카드가 ID가 1인 상세 페이지로 리디렉션되고 있습니다. 이는 사용자가 선택한 특정 크루의 상세 정보를 볼 수 없게 만드는 심각한 문제입니다.
API 연결 후 수정 예정이라는 주석이 있지만, 이러한 임시 변경은 다음과 같은 문제를 야기할 수 있습니다:
- 사용자가 잘못된 크루 정보를 보게 됨
- 크루 상세 페이지로의 올바른 네비게이션이 불가능
- 사용자 경험 저하
다음과 같이 수정해주세요:
- // NOTE: api연결 후 되돌리기
- // const CREWPAGE = `/crew/detail/${id}`;
- const CREWPAGE = `/crew/detail/1`;
+ const CREWPAGE = `/crew/detail/${id}`;만약 API 연결이 아직 준비되지 않았다면, 임시 데이터(mock data)를 사용하는 것을 고려해보세요.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // NOTE: api연결 후 되돌리기 | |
| // const CREWPAGE = `/crew/detail/${id}`; | |
| const CREWPAGE = `/crew/detail/1`; | |
| const CREWPAGE = `/crew/detail/${id}`; |
yulrang
left a comment
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.
수고하셨습니다~!~
minkyung5x5
left a comment
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.
수고하셨습니다!!!!
🔖 Issue Ticket
Ticket
✍️ Description
✅ Checklist
PR
Test
Summary by CodeRabbit
CrewCard컴포넌트의 URL 동적 생성 방식 변경, 현재는 하드코딩된 값 사용.CrewCard의 변경 사항에 대한 주석 추가, API 연결 후 원래 동적 URL 구조로 되돌릴 계획 언급.