diff --git a/Runnect-iOS/Runnect-iOS/Network/Foundation/NetworkHelper.swift b/Runnect-iOS/Runnect-iOS/Network/Foundation/NetworkHelper.swift deleted file mode 100644 index 01305906..00000000 --- a/Runnect-iOS/Runnect-iOS/Network/Foundation/NetworkHelper.swift +++ /dev/null @@ -1,28 +0,0 @@ -// -// NetworkHelper.swift -// Runnect-iOS -// -// Created by sejin on 2023/01/06. -// - -import Foundation - -import Moya - -struct NetworkHelper { - private init() {} - - // 상태 코드와 데이터, decoding type을 가지고 통신의 결과를 핸들링하는 함수 - static func parseJSON (by statusCode: Int, data: Data, type: T.Type) -> NetworkResult { - let decoder = JSONDecoder() - - guard let decodedData = try? decoder.decode(BaseResponse.self, from: data) else { return .pathErr("pathErr") } - - switch statusCode { - case 200..<300: return .success(decodedData.data as Any) - case 400..<500: return .requestErr(decodedData.data as Any) - case 500..<600: return .serverErr - default: return .networkFail - } - } -} diff --git a/Runnect-iOS/Runnect-iOS/Network/Foundation/NetworkResult.swift b/Runnect-iOS/Runnect-iOS/Network/Foundation/NetworkResult.swift deleted file mode 100644 index 2990a585..00000000 --- a/Runnect-iOS/Runnect-iOS/Network/Foundation/NetworkResult.swift +++ /dev/null @@ -1,16 +0,0 @@ -// -// NetworkResult.swift -// Runnect-iOS -// -// Created by sejin on 2023/01/06. -// - -import Foundation - -enum NetworkResult { - case success(T) // 서버 통신 성공했을 때 - case requestErr(T) // 요청 에러 발생했을 때 - case pathErr(T) // 경로 에러 발생했을 때 - case serverErr // 서버의 내부 에러가 발생했을 때 - case networkFail // 네트워크 연결 실패했을 때 -}