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 { do {
let user = try await self.apiService.getUser(userId) let user = try await self.apiService.getUser(userId)
self.currentUser = .success(user) self.currentUser = .success(user)
await getBudgets()
} catch { } catch {
self.currentUser = .error(error) self.currentUser = .error(error)
} }

View file

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