mirror of
https://github.com/metabolist/metatext.git
synced 2024-11-25 09:41:00 +00:00
Refactoring
This commit is contained in:
parent
758c375547
commit
9507343511
2 changed files with 3 additions and 10 deletions
|
@ -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 a new issue