Fix initial budget loading and login/budget list sheet dismissal
This commit is contained in:
parent
19cd44296a
commit
d22b1defc8
2 changed files with 6 additions and 12 deletions
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue