This commit is contained in:
Trey t
2023-06-25 10:59:20 -05:00
parent 01915752b6
commit 24ee992f93
14 changed files with 448 additions and 727 deletions

View File

@@ -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")
}
})