mirror of
https://github.com/metabolist/metatext
synced 2024-12-27 10:12:36 +01:00
Refactoring
This commit is contained in:
parent
758c375547
commit
9507343511
@ -218,17 +218,12 @@ public extension ContentDatabase {
|
||||
.eraseToAnyPublisher()
|
||||
}
|
||||
|
||||
func accountObservation(id: String) -> AnyPublisher<Account?, Error> {
|
||||
func accountObservation(id: String) -> AnyPublisher<Account, Error> {
|
||||
ValueObservation.tracking(AccountInfo.request(AccountRecord.filter(AccountRecord.Columns.id == id)).fetchOne)
|
||||
.removeDuplicates()
|
||||
.map {
|
||||
if let info = $0 {
|
||||
return Account(info: info)
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
.publisher(in: databaseWriter)
|
||||
.compactMap { $0 }
|
||||
.map(Account.init(info:))
|
||||
.eraseToAnyPublisher()
|
||||
}
|
||||
|
||||
|
@ -35,8 +35,6 @@ public struct ProfileService {
|
||||
self.contentDatabase = contentDatabase
|
||||
|
||||
var accountPublisher = contentDatabase.accountObservation(id: accountID)
|
||||
.compactMap { $0 }
|
||||
.eraseToAnyPublisher()
|
||||
|
||||
if let account = account {
|
||||
accountPublisher = accountPublisher
|
||||
|
Loading…
Reference in New Issue
Block a user