Skip to content
This repository has been archived by the owner on Feb 28, 2023. It is now read-only.

Commit

Permalink
Add .errorLoading
Browse files Browse the repository at this point in the history
  • Loading branch information
otaviocc committed Feb 27, 2021
1 parent aec5267 commit 29a49ab
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Sources/PinboardKit/API/PinboardAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public struct PinboardAPI {
return .loading
case .finishedLoading:
return .finishedLoading
case .errorLoading:
return .errorLoading
}
}
.eraseToAnyPublisher()
Expand Down
1 change: 1 addition & 0 deletions Sources/PinboardKit/API/PinboardAPIEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ import Foundation
public enum PinboardAPIEvent {
case loading
case finishedLoading
case errorLoading
}
4 changes: 4 additions & 0 deletions Sources/PinboardKit/NetworkClient/PinboardClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ struct PinboardClient {
response: result.response
)
}
.mapError{ error -> Error in
eventSubject.send(.errorLoading)
return error
}
.receive(on: DispatchQueue.main)
.eraseToAnyPublisher()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ import Foundation
enum PinboardClientEvent {
case loading
case finishedLoading
case errorLoading
}

0 comments on commit 29a49ab

Please sign in to comment.