Fix initial budget loading and login/budget list sheet dismissal

This commit is contained in:
William Brawner 2022-05-17 20:34:46 -06:00
parent 19cd44296a
commit d22b1defc8
2 changed files with 6 additions and 12 deletions

View file

@ -436,6 +436,7 @@ class DataStore : ObservableObject {
do {
let user = try await self.apiService.getUser(userId)
self.currentUser = .success(user)
await getBudgets()
} catch {
self.currentUser = .error(error)
}

View file

@ -73,26 +73,19 @@ struct TabbedBudgetView: View {
var body: some View {
mainView.sheet(isPresented: $dataStore.showLogin,
onDismiss: {
Task {
await self.dataStore.getBudgets()
}
},
content: {
LoginView()
.environmentObject(dataStore)
.onDisappear {
Task {
await self.dataStore.getBudgets()
}
}
}).sheet(isPresented: $dataStore.showBudgetSelection,
.interactiveDismissDisabled(true)
})
.sheet(isPresented: $dataStore.showBudgetSelection,
content: {
List {
BudgetListsView().environmentObject(dataStore)
}
})
.interactiveDismissDisabled(true)
})
}
}