-
Notifications
You must be signed in to change notification settings - Fork 7
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
refactor: 모든 API 호출 로직이 codegen을 통하도록 수정함 #226
Merged
Merged
Changes from 12 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
7a27cc9
fix: axios instance 교체
saengmotmi 8b0fda6
fix: 타입 에러 제거
saengmotmi 6b0da3e
fix: 아직 MyFeed에 문제 있음
saengmotmi 19c17fb
fix: 피드 원상 복구
saengmotmi 451151d
fix: nav
saengmotmi 3e00a93
fix: app router용 쿠키 로직 - auth wip
saengmotmi ec0dbd0
fix: 잘못된 토큰 주입 수정
saengmotmi cf00725
fix: nav 프로필 영역 깜빡임 문제 해결
saengmotmi 1327873
fix: 카드 간격 조정
saengmotmi 3879583
refactor: 불필요한 코드 제거
saengmotmi ee35189
refactor: 토큰 관련 로직 정리
saengmotmi 186b9e9
refactor: 프로필 컴포넌트 정리
saengmotmi fb4c782
chore: 불필요한 로직 제거
saengmotmi 9a2e983
fix: 비 로그인 상태에서도 정상 동작
saengmotmi 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 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 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 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 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 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 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 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
32 changes: 32 additions & 0 deletions
32
apps/next-app/src/components/common/Layout/Nav/Profile.tsx
This file contains 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,32 @@ | ||
'use client' | ||
import { useSuspenseQuery } from '@tanstack/react-query' | ||
|
||
import { CACHE_KEYS } from 'services/cacheKeys' | ||
import { getUserInfoUsingGET } from 'services/types/_generated/user' | ||
import ProfilePopover from './ProfilePopover' | ||
|
||
import * as S from './Nav.style' | ||
|
||
export const Profile = () => { | ||
const { data: userProfile } = useSuspenseQuery({ | ||
queryKey: CACHE_KEYS.me, | ||
queryFn: getUserInfoUsingGET, | ||
}) | ||
|
||
return ( | ||
<ProfilePopover> | ||
<S.MyPageButton> | ||
<S.UserName>{`${userProfile.name}님, 안녕하세요!`}</S.UserName> | ||
{userProfile.profileImageUrl && ( | ||
<S.UserImage | ||
width={32} | ||
height={32} | ||
alt="프로필 사진" | ||
src={userProfile.profileImageUrl} | ||
priority | ||
/> | ||
)} | ||
</S.MyPageButton> | ||
</ProfilePopover> | ||
) | ||
} |
This file contains 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 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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
'use client' | ||
|
||
import { useRouter } from 'next/router' | ||
import { SwitchCase } from '@toss/react' | ||
|
||
|
This file contains 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
6 changes: 3 additions & 3 deletions
6
apps/next-app/src/components/views/Feeds/Recommended/RecommendedChannels.tsx
This file contains 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
6 changes: 3 additions & 3 deletions
6
apps/next-app/src/components/views/Feeds/Recommended/RecommendedPosts.tsx
This file contains 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
Oops, something went wrong.
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.
조건이 이렇게 걸리면 피둥을 사용하지 않는(혹은 로그인하지 않은 유저)가 타인의 구독리스트를 보러 들어 갔을 때 오른쪽 상단에 아무 것도 노출되지 않게 되는데 의도하신걸까요? 👀 개인적으로는 타인의 구독 리스트를 보러 갔을때 우측 상단에 '피둥 시작하기' 버튼을 띄워주면 유입의 가능성이 있다고 생각해서 피둥시작하기 버튼 or 프로필 노출의 분기 조건을 로그인 여부로 사용하면 어떨까 하는 의견이에요
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.
@eunsonny 깜빡임이 있어서 저렇게 처리가 되었던 것인데 말씀해주신 케이스는 제가 놓쳤어요
적절한 조건을 찾아서 수정해볼게요
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.
깜빡임의 원인을 찾았는데요 말씀하신 대로 로그인 시 보이도록 하되
핵심은 아래 함수인데요
여기에서 앱 라우터 내 로직이면 getNextCookies를 타면서 cookie를 불러오고, 페이지 라우터 & 클라이언트 로직이면 js-cookie의 Cookies 로직을 타도록 되어 있어요.
근데 제가 놓지고 있던게 js-cookie는 서버 측에서는 기본적으로 동작하질 않아요
https://github.com/js-cookie/js-cookie/blob/main/src/api.mjs#L4-L8
깔려 있지만 사용되지 않고 있는 nookies라는 라이브러리를 사용하면 동작하긴 하는데 그러려면 getServerSideProps에서 ctx 객체에 접근해 cookie 값을 읽고 내려줘야 하는데... 현재 코드 구조 상 이걸 전역적으로 주고 받을 수가 없어서(app router에서는 전역적으로 주고 받기 위한 구현이 추가되었어요) 쿠키 관련 로직 사용하기가 좀 곤란해요.
이 문제를 해결하기 위해 서버 측에서 AsyncLocalStoarge를 사용하도록 하거나 잠시 흐린 눈 하는 방법을 선택해야 할거 같아요
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.
fyi) https://nodejs.org/api/async_context.html#class-asynclocalstorage
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.
아하 이해했습니당
이 방향으로 진행하는 것으로 알고 있겠습니다. 저는 app router로 빠르게 마이그레이션에 힘을 보탤게요(...)