revert to previous invocation from KN clients to pick up changes fron db

This commit is contained in:
John O'Reilly 2020-08-31 21:42:51 +01:00
parent 98c9c3e0ff
commit e0ea583aa6
4 changed files with 16 additions and 17 deletions

View file

@ -39,8 +39,13 @@ class PeopleInSpaceRepository() : KoinComponent {
}
}
@Throws(Exception::class)
suspend fun fetchPeople() = peopleInSpaceApi.fetchPeople().people
fun fetchPeople(success: (List<Assignment>) -> Unit) {
GlobalScope.launch(Dispatchers.Main) {
fetchPeopleAsFlow()?.collect {
success(it)
}
}
}
@Throws(Exception::class)
suspend fun fetchISSPosition() = peopleInSpaceApi.fetchISSPosition().iss_position

View file

@ -11,11 +11,9 @@ class PeopleInSpaceViewModel: ObservableObject {
}
func fetch() {
repository.fetchPeople { (data, error) in
if let people = data {
self.people = people
}
}
repository.fetchPeople(success: { data in
self.people = data
})
}
}

View file

@ -12,11 +12,9 @@ class PeopleInSpaceViewModel: ObservableObject {
}
func fetchPeople() {
repository.fetchPeople { (data, error) in
if let people = data {
self.people = people
}
}
repository.fetchPeople(success: { data in
self.people = data
})
}
func fetchISSPosition() {

View file

@ -10,11 +10,9 @@ class PeopleInSpaceViewModel: ObservableObject {
}
func fetch() {
repository.fetchPeople { (data, error) in
if let people = data {
self.people = people
}
}
repository.fetchPeople(success: { data in
self.people = data
})
}
}