Apply request to display status

This commit is contained in:
Justin Mazzocchi 2020-09-02 02:12:42 -07:00
parent cb8a36023d
commit 825eb8bf39
No known key found for this signature in database
GPG key ID: E223E6937AAFB01C

View file

@ -18,9 +18,9 @@ public struct StatusService {
public extension StatusService {
func toggleFavorited() -> AnyPublisher<Never, Error> {
networkClient.request(status.favourited
? StatusEndpoint.unfavourite(id: status.id)
: StatusEndpoint.favourite(id: status.id))
networkClient.request(status.displayStatus.favourited
? StatusEndpoint.unfavourite(id: status.displayStatus.id)
: StatusEndpoint.favourite(id: status.displayStatus.id))
.map { ([$0], nil) }
.flatMap(contentDatabase.insert(statuses:timeline:))
.eraseToAnyPublisher()