From d22b1defc8c1d30378b7aa8a22665980870ec574 Mon Sep 17 00:00:00 2001 From: Billy Brawner Date: Tue, 17 May 2022 20:34:46 -0600 Subject: [PATCH] Fix initial budget loading and login/budget list sheet dismissal --- Twigs/DataStore.swift | 1 + Twigs/TabbedBudgetView.swift | 17 +++++------------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/Twigs/DataStore.swift b/Twigs/DataStore.swift index 6e09051..490b7a7 100644 --- a/Twigs/DataStore.swift +++ b/Twigs/DataStore.swift @@ -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) } diff --git a/Twigs/TabbedBudgetView.swift b/Twigs/TabbedBudgetView.swift index 38e5c00..516e0a8 100644 --- a/Twigs/TabbedBudgetView.swift +++ b/Twigs/TabbedBudgetView.swift @@ -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) + }) } }