diff --git a/Tuist/Interfaces/UIKit/Sources/Data/NetworkAPI/Core/NetworkAPIProtocol.swift b/Tuist/Interfaces/UIKit/Sources/Data/NetworkAPI/Core/NetworkAPIProtocol.swift index ff17c8a9..c2ee0030 100644 --- a/Tuist/Interfaces/UIKit/Sources/Data/NetworkAPI/Core/NetworkAPIProtocol.swift +++ b/Tuist/Interfaces/UIKit/Sources/Data/NetworkAPI/Core/NetworkAPIProtocol.swift @@ -19,28 +19,15 @@ extension NetworkAPIProtocol { configuration: RequestConfiguration, decoder: JSONDecoder ) async throws -> T { - try await withCheckedThrowingContinuation { continuation in - session.request( - configuration.url, - method: configuration.method, - parameters: configuration.parameters, - encoding: configuration.encoding, - headers: configuration.headers, - interceptor: configuration.interceptor - ) - .response { response in - switch response.result { - case let .success(data): - do { - let decodedData = try decoder.decode(T.self, from: data ?? Data()) - continuation.resume(returning: decodedData) - } catch { - continuation.resume(throwing: error) - } - case let .failure(error): - continuation.resume(throwing: error) - } - } - } + try await session.request( + configuration.url, + method: configuration.method, + parameters: configuration.parameters, + encoding: configuration.encoding, + headers: configuration.headers, + interceptor: configuration.interceptor + ) + .serializingDecodable(T.self) + .value } }