init: axios, tanstack query 세팅 #12
Merged
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
#️⃣ Related Issue
Closes #8
☀️ New-insight
💎 PR Point
interceptor 설명
공통 API 유틸함수 설명
각각 get, post, put, patch, delete 요청을 래핑해서 instance에 연결한 유틸 함수들 입니다.
이런식으로 더 간결하게 작성할 수 있습니다. 미리 정의해둔 이유는, 매번 axios.instance.get ... 등을 쓰지 않고 짧고 일관된 API 호출 패턴을 유지하고, 응답 구조를 명확히해 타입 오류방지+코드 가독성을 향상시키기 위해서입니다. 이후 요청별 공통 처리(로깅, 로딩, 에러처리 등)을 이곳에만 추가하면 됩니다.
query-client
대부분의 API 응답은 단시간에 변경되지는 않으므로 1분정도를 fresh하게 유지했습니다.
사용자가 다시 탭을 클릭했을때 자동으로 refetch되지 않도록 refetchOnWindowFocus 설정을 false로 작성했습니다. 탭 이동만으로 데이터를 재요청하는건 오히려 성능과 UX를 해칠 수 있습니다.
📸 Screenshot
Summary by CodeRabbit
신규 기능
스타일