WIP
This commit is contained in:
@@ -46,14 +46,22 @@ struct AllWorkoutsView: View {
|
||||
}
|
||||
}.onAppear{
|
||||
if needsUpdating {
|
||||
AllWorkoutFetchable().fetch(completion: { result in
|
||||
needsUpdating = false
|
||||
switch result {
|
||||
case .success(let model):
|
||||
DispatchQueue.main.async {
|
||||
self.workouts = model
|
||||
}
|
||||
case .failure(let failure):
|
||||
UserStore.shared.login(completion: { success in
|
||||
if success {
|
||||
DataStore.shared.fetchAllData()
|
||||
|
||||
AllWorkoutFetchable().fetch(completion: { result in
|
||||
needsUpdating = false
|
||||
switch result {
|
||||
case .success(let model):
|
||||
DispatchQueue.main.async {
|
||||
self.workouts = model
|
||||
}
|
||||
case .failure(let failure):
|
||||
fatalError("shit broke")
|
||||
}
|
||||
})
|
||||
} else {
|
||||
fatalError("shit broke")
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user