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

refactor: react query 커스텀 hook 파일 리펙터링 #61

Merged
merged 9 commits into from
Jul 22, 2023

Conversation

ojj1123
Copy link
Collaborator

@ojj1123 ojj1123 commented Jul 21, 2023

📮 관련 이슈

🌱 PR 포인트

  • react query 커스텀 hook 파일 이동
    • 각 도메인 당 hook이 index.ts에 몰려 있던 걸 각 hook 마다 파일을 만들어 주었음
    • queryKey도 마찬가지로 queryKey.ts에 몰려 있던 걸 각 hook 파일 안에 넣어줌
# as-is
/application/hooks/api/{도메인}
  /index.ts
  /queryKey.ts

# to-be
/api/{도메인}
  /useGet***.ts
  /usePost***.ts
  /useDelete***.ts
  • QueryClientProvider 파일을 /api/core 로 옮김
  • application 폴더 삭제
  • queryFn 이 모여있는 /infra/api 폴더는 인증/인가 설계랑 엮기는 부분이 있어 일단은 그대로 두었습니다. queryFn 만 이동시키면 되는 문제가 아니라 인증/인가 설계도 함께 해야해서 ♻️ Refactor: 폴더 구조 변경 및 react-query 구조 개선 #56 PR을 merge한 후 따로 이슈를 생성해서 진행하겠습니다.

- /application/hooks/api/core -> /api/core
- useCoreInfiniteQuery 추후 리팩터링 시 삭제 예정
- /infra/api/index.ts -> /api/core/axios.ts
- /infra/api/index.ts 삭제 예정
- /application/hooks/api/meme -> /api/meme
- /application/hooks/api/tags -> /api/tag
- /application/hooks/api/collection -> /api/collection
- /application/hooks/api/search -> /api/search
- useGetUserFindMemes(회원이 찾는 밈 API) 삭제(dead code)
- /application/hooks/api/account -> /api/account
- /application -> /api/core
- DefaultPageProps 타입을 /api/core/query-client.tsx 로 이동
- /api/core/axios.ts 로 이동함
@ojj1123 ojj1123 added the refactor Refectoring label Jul 21, 2023
@ojj1123 ojj1123 requested a review from elbica as a code owner July 21, 2023 15:33
@ojj1123 ojj1123 self-assigned this Jul 21, 2023
@ojj1123 ojj1123 requested a review from SeieunYoo as a code owner July 21, 2023 15:33
@vercel
Copy link

vercel bot commented Jul 21, 2023

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

Name Status Preview Updated (UTC)
thismeme-web ✅ Ready (Inspect) Visit Preview Jul 21, 2023 3:33pm

@ojj1123 ojj1123 merged commit 8e8bc12 into refactor/issue-53 Jul 22, 2023
1 check passed
@ojj1123 ojj1123 deleted the refactor/issue-53_react-query branch July 22, 2023 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Refectoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant