-
Notifications
You must be signed in to change notification settings - Fork 3
fix: 랜딩페이지 cta 분기, 사이드바 반응형 충돌, 로고 경로, 캐시 통일 #88
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| 'use client'; | ||
|
|
||
| import { useRouter } from 'next/navigation'; | ||
| import { useCurrentUserQuery } from '@/shared/queries/user/useCurrentUserQuery'; | ||
| import BaseButton from '@/components/Button/base/BaseButton'; | ||
|
|
||
| type CtaButtonProps = { | ||
| className?: string; | ||
| }; | ||
|
|
||
| /** | ||
| * 랜딩페이지 "지금 시작하기" 버튼 | ||
| * | ||
| * 로그인 상태 분기: | ||
| * - 비로그인 → /login | ||
| * - 로그인 → /{teamId} (팀이 있는 경우) 또는 /addteam | ||
| */ | ||
| export default function CtaButton({ className }: CtaButtonProps) { | ||
| const router = useRouter(); | ||
| const { data: user, isPending } = useCurrentUserQuery({ retry: false }); | ||
|
|
||
| const handleClick = () => { | ||
| if (isPending) return; | ||
|
|
||
| if (!user) { | ||
| router.push('/login'); | ||
| return; | ||
| } | ||
|
|
||
| // user.teamId는 프로젝트 식별자 문자열('20-1' 등)이라 팀 페이지 경로에 사용 불가 | ||
| // 실제 그룹 페이지 경로는 숫자 group.id를 사용해야 함 | ||
| const groupId = user.memberships?.[0]?.group?.id; | ||
| router.push(groupId !== undefined ? `/${groupId}` : '/addteam'); | ||
| }; | ||
|
|
||
| return ( | ||
| <div className={className}> | ||
| <BaseButton onClick={handleClick}>지금 시작하기</BaseButton> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -14,8 +14,8 @@ export function currentUserQueryOptions() { | |||||||||||||
| }); | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| export function useCurrentUserQuery() { | ||||||||||||||
| return useQuery(currentUserQueryOptions()); | ||||||||||||||
| export function useCurrentUserQuery(options?: { retry?: boolean | number }) { | ||||||||||||||
| return useQuery({ ...currentUserQueryOptions(), ...options }); | ||||||||||||||
| } | ||||||||||||||
|
Comment on lines
+17
to
19
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 현재
Suggested change
|
||||||||||||||
|
|
||||||||||||||
| export function useSuspenseCurrentUserQuery() { | ||||||||||||||
|
|
||||||||||||||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
로그인 후 사용자 정보를 가져오는 데 실패했을 때, 에러를 던져서 catch 블록에서 처리하도록 하는 것이 더 안전해 보입니다. 현재 코드는 사용자 정보 조회에 실패하면 무조건 팀 추가 페이지로 보내는데, 이는 일시적인 네트워크 오류인 경우 사용자에게 혼란을 줄 수 있습니다. 에러를 발생시켜
catch블록에서 '네트워크 오류' 메시지를 보여주는 것이 더 나은 사용자 경험을 제공할 것입니다.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.
이 코드리뷰는 고치지 않아도 됩니다. /addteam으로 보내는 이유는 로그인 성공 상태에서 토큰도 쿠키에 저장된 상태에서 유저 정보 조회가 일시적으로 실패한 경우 /addteam으로 보내면 거기서 다시 유저 정보를 받아오고, 팀이 있으면 자동으로 팀 페이지로 이동하도록 설계됐습니다. 즉 최악의 경우에도 로그인 상태는 유지되고 정상 경로로 복구됩니다.
AI 제안처럼 에러를 던지면:
로그인 성공 → 유저 정보 조회 실패 → 에러 → catch 블록 → setError('email', ...) → 사용자는 로그인 실패로 인식
이건 실제로 로그인은 됐는데 사용자한테 실패처럼 보여주는 거라 더 혼란스러울 수 있습니다.