Conversation
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
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.
구현 내용 요약
NetworkManager
• request<T: Decodable>(_ endPoint:) async -> T? 제네릭 메서드로 호출부에서 원하는 타입으로 디코딩 가능
• makeDataRequest에서 APITask case별 Alamofire 요청 생성 (plain, JSON body, parameters, without interceptor)
Interceptor
• adapt: 키체인에서 accessToken을 읽어 Bearer 헤더 자동 추가. 토큰 없으면 isLogin = false 설정
• retry: 401 응답 시 refreshAccessToken() 호출 후 성공하면 retry, 실패하면 isLogin = false 설정
• refreshAccessToken(): 토큰 갱신 함수 (TODO: 실제 API 연동 필요)
APITask
• requestPlain: 파라미터 없는 단순 요청
• requestJSONEncodable(body:): JSON Body 요청
• requestParameters(parameters:): URL 쿼리 파라미터 요청
• requestWithoutInterceptor(body:): 인터셉터 없는 요청 (로그인/회원가입 등 토큰 불필요 API용)
EndPoint
/// API 서버 기본 URL (e.g., "https://api.bangawo.com")
• baseURL: String { get }
/// API 경로 (e.g., "/users/login")
• var path: String { get }
/// HTTP 메서드 (GET, POST, PUT, DELETE 등)
• var method: HTTPMethod { get }
/// HTTP 헤더
• var headers: HTTPHeaders? { get }
/// 요청 파라미터 방식 (body, query 등)
• var task: APITask { get }
BaseResponse
• status
• message
• data