WIP
This commit is contained in:
@@ -25,7 +25,16 @@ class DataStore: ObservableObject {
|
||||
|
||||
private let fetchAllDataQueue = DispatchGroup()
|
||||
|
||||
public func fetchAllData() {
|
||||
public var workoutsUniqueUsers: [RegisteredUser]? {
|
||||
guard let workouts = allWorkouts else {
|
||||
return nil
|
||||
}
|
||||
|
||||
let users = workouts.compactMap({ $0.registeredUser })
|
||||
return Array(Set(users))
|
||||
}
|
||||
|
||||
public func fetchAllData(completion: @escaping (() -> Void)) {
|
||||
status = .loading
|
||||
|
||||
fetchAllDataQueue.enter()
|
||||
@@ -35,6 +44,7 @@ class DataStore: ObservableObject {
|
||||
|
||||
fetchAllDataQueue.notify(queue: .main) {
|
||||
self.status = .idle
|
||||
completion()
|
||||
}
|
||||
|
||||
AllWorkoutFetchable().fetch(completion: { result in
|
||||
|
||||
Reference in New Issue
Block a user