Skip to content

Commit

Permalink
[Release] v2.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoe0929 committed Jul 23, 2024
2 parents b9383ec + bffd91d commit 976f24c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
6 changes: 3 additions & 3 deletions YELLO-iOS/YELLO-iOS/Network/Base/APIRequestLoader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ class APIRequestLoader<T: TargetType> {

private func judgeStatus<M: Decodable>(by statusCode: Int, _ data: Data, type: M.Type) -> NetworkResult<M> {
switch statusCode {
case 200...299: return isValidData(data: data, type: M.self)
case 400, 402...499: return isValidData(data: data, type: M.self)
case 500: return .serverErr
case 200...299, 403, 404: return isValidData(data: data, type: M.self)
case 400, 402, 405...499: return .requestErr(statusCode: statusCode)
case 500: return .serverErr(statusCode: statusCode)
case 401: return .failure
default: return .networkErr
}
Expand Down
4 changes: 2 additions & 2 deletions YELLO-iOS/YELLO-iOS/Network/Base/NetworkResult.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import Foundation

enum NetworkResult<T> {
case success(T) // 서버 통신 성공
case requestErr(T) // 요청에러 발생
case requestErr(statusCode: Int) // 요청에러 발생
case pathErr // 경로 에러
case serverErr // 서버 내부 에러
case serverErr(statusCode: Int) // 서버 내부 에러
case networkErr // 네트워크 연결 실패
case failure // 실패
}
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,14 @@ class RecommendIdViewController: OnboardingBaseViewController {
Amplitude.instance().setUserProperties(userProperties)
self.didPostUserInfo = true
self.navigationController?.pushViewController(pushViewController, animated: false)
case .requestErr(let statusCode):
self.view.showToast(message: "오류가 발생했습니다. code: \(statusCode)", at: 180.adjusted)
case .serverErr(let statusCode):
self.view.showToast(message: "오류가 발생했습니다. code: \(statusCode)", at: 180.adjusted)
let sceneDelegate = UIApplication.shared.connectedScenes.first?.delegate as! SceneDelegate
kakaoLoginViewController.isFromOnboarding = true
sceneDelegate.window?.rootViewController = UINavigationController(rootViewController: kakaoLoginViewController)
return
default:
self.isFail = true
self.view.showToast(message: "오류가 발생했습니다. 잠시후 다시 시도해주세요.")
Expand Down

0 comments on commit 976f24c

Please sign in to comment.