Skip to content

Commit

Permalink
♻️ :: completion skipping
Browse files Browse the repository at this point in the history
  • Loading branch information
baekteun committed Jun 9, 2023
1 parent d5bfd7e commit 00316b9
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions Sources/Emdpoint/EmdpointClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,16 @@ public final class EmdpointClient<Endpoint: EndpointType>: EmdpointClientProtoco

public func request(_ endpoint: Endpoint) async throws -> DataResponse {
try await withCheckedThrowingContinuation { config in
self.request(endpoint) { result in
config.resume(with: result)
}
self.request(endpoint, completion: config.resume(with:))
}
}

public func requestPublisher(
_ endpoint: Endpoint
) -> AnyPublisher<DataResponse, EmdpointError> {
Future { fulfill in
self.request(endpoint) { result in
fulfill(result)
Deferred {
Future { fulfill in
self.request(endpoint, completion: fulfill)
}
}
.eraseToAnyPublisher()
Expand Down

0 comments on commit 00316b9

Please sign in to comment.