Chore: axios 코드에 타입 선언 / router마다 log 추가#1
Open
NARARIA03 wants to merge 2 commits intoDevFret:mainfrom
Open
Conversation
try - catch를 사용하고, response와 error에 제네릭 문법과 isAxiosError를 사용해서 타입을 적용해주었다.
어떤 router가 어떤 상태코드로 어떤걸 반환하는지를 console.log로 함께 작 성해서 터미널로도 로그인 / 토큰 검증 로직이 어떻게 동작 중인지 파악하기 쉽도록 해주었다.
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
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.
변경사항
kakao.ts:axios라이브러리로 카카오 로그인 API와 통신하는 부분에서 제네릭 문법을 사용해AxiosResponse를 명확하게 지정해줬고,isAxiosError()함수를 사용해catch문의error를AxiosError로 명확하게 지정해줬다.kakaoRouter.ts,tokenRouter.ts: 기존에 있던 log 대신, 각 API들이 성공했는지, 실패했다면 무슨 원인으로 실패했는지를 나타내는 로그만 간략하게 하나씩 가지도록 변경했다. 여러 API 호출이 발생할 경우, 순서대로 잘 실행되었는지 / 어떤 API에서 오류가 발생했는지 원활하게 확인할 수 있을 것으로 기대한다.kakao.ts