-
Notifications
You must be signed in to change notification settings - Fork 1
Feat/#67 유저 정보 조회 api 관련 로직 구현 및 찜하기 낙관적 업데이트 도입 #68
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
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7991874
refactor: API responses return 형식 수정
leeleeleeleejun a6e8029
feat: 사용자 데이터 조회 쿼리 및 스키마 추가
leeleeleeleejun 6e658e0
feat: 프로필 페이지 컴포넌트 구조 변경
leeleeleeleejun d0f99ae
feat: 찜하기, 찜 취소 응답 성공 시 쿼리 무효화 로직 개선
leeleeleeleejun 91df22c
feat: 개선된 좋아요 버튼 로직 및 애니메이션 처리
leeleeleeleejun 5a6ebe6
fix: users/me 경로 수정
leeleeleeleejun 3b6309e
feat: update zod import syntax to named import
leeleeleeleejun 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,15 @@ | ||
| import { queryOptions } from '@tanstack/react-query' | ||
| import { getUserData } from '@/_apis/services/user' | ||
|
|
||
| export const UserQueryKeys = { | ||
| all: () => ['user'] as const, | ||
| detail: () => [...UserQueryKeys.all(), 'detail'] as const, | ||
| } | ||
|
|
||
| export const useUserQueries = { | ||
| detail: () => | ||
| queryOptions({ | ||
| queryKey: UserQueryKeys.detail(), | ||
| queryFn: getUserData, | ||
| }), | ||
| } |
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,9 @@ | ||
| import { z } from 'zod' | ||
|
|
||
| export const UserSchema = z.object({ | ||
| nickname: z.string(), | ||
| profileImageUrl: z.url(), | ||
| profileBackgroundHexCode: z.string(), | ||
| }) | ||
|
|
||
| export type User = z.infer<typeof UserSchema> |
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 |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import axiosInstance from '@/_lib/axiosInstance' | ||
| import { API_PATH } from '@/_constants/path' | ||
| import { User, UserSchema } from '@/_apis/schemas/user' | ||
|
|
||
| export const getUserData = async (): Promise<User> => { | ||
| const { data } = await axiosInstance.get(API_PATH.USER) | ||
| return UserSchema.parse(data) | ||
| } |
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 was deleted.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
apps/web/app/profile/_components/ProfileMenuItem/ProfileMenuItem.tsx
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,19 @@ | ||
| import { Icon, IconType } from '@repo/ui/components/Icon' | ||
| import { Flex, JustifyBetween } from '@repo/ui/components/Layout' | ||
| import { Text } from '@repo/ui/components/Text' | ||
|
|
||
| type Props = { | ||
| href: string | ||
| title: string | ||
| icon: IconType | ||
| } | ||
|
|
||
| export const ProfileMenuItem = ({ href, title, icon }: Props) => ( | ||
| <JustifyBetween as={'a'} href={href}> | ||
| <Flex className={'gap-2.5'}> | ||
| <Icon type={icon} size={18} /> | ||
| <Text variant={'body1'}>{title}</Text> | ||
| </Flex> | ||
| <Icon type={'arrowRight'} size={18} color={'--color-gray-200'} /> | ||
| </JustifyBetween> | ||
| ) |
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 @@ | ||
| export { ProfileMenuItem } from './ProfileMenuItem' |
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.
🧩 Analysis chain
Response 타입 변경을 백엔드 API와 검증해주세요.
placeId의 타입이string에서number로 변경되었습니다. 백엔드 API 응답 스펙과 일치하는지 확인이 필요합니다. 만약 백엔드가 문자열을 반환한다면 런타임 에러가 발생할 수 있습니다.백엔드 API 응답 형식을 확인하기 위한 스크립트:
🏁 Script executed:
Length of output: 1658
추가 검증을 위해 코드베이스 내 Response 타입 사용 패턴과 API 응답 스펙을 확인하겠습니다.
Length of output: 550
🏁 Script executed:
Length of output: 4277
🏁 Script executed:
Length of output: 819
🏁 Script executed:
Length of output: 502
Length of output: 1935
🏁 Script executed:
Length of output: 160
🏁 Script executed:
Length of output: 2178
🏁 Script executed:
Length of output: 1532
Length of output: 464
🏁 Script executed:
Length of output: 842
Response 타입의
placeId를number에서string으로 수정해주세요.Mock 데이터(
apps/web/app/_mocks/handlers/likeHandlers.ts)에서 백엔드 응답은placeId: '1'(문자열)로 정의되어 있으나, Response 타입(apps/web/app/_apis/services/like.ts)은placeId: number로 선언되어 있습니다.현재 코드에서
useAddLike.ts와useRemoveLike.ts가String(placeId)변환을 하는 것도 이 불일치 때문입니다. TypeScript는 런타임 타입 체크를 하지 않으므로, 실제 백엔드도 문자열을 반환한다면 예상치 못한 타입 에러가 발생할 수 있습니다.수정 위치:
apps/web/app/_apis/services/like.ts4-7줄🤖 Prompt for AI Agents