diff --git a/Services/OrgService.swift b/Services/OrgService.swift index 87d8e83..b904ca3 100644 --- a/Services/OrgService.swift +++ b/Services/OrgService.swift @@ -22,6 +22,9 @@ class OrgService: ObservableObject { self.errorService = errors } + // Wasn't getting called before -> Never leaving loading state. + // For now called when retrieveOrganisations also called + // Maybe move getCode into the retrieve Func? func getOrganisation() { let locallyCachedOrganization = retrieveFromDisk() self.organization = locallyCachedOrganization @@ -33,7 +36,6 @@ class OrgService: ObservableObject { let org = try await self.retrieveOrganisation() DispatchQueue.main.async { self.organization = org - self.loadingState = .finished(Date()) } } catch { diff --git a/Shared/Navigational Structure/LeftSidebarView.swift b/Shared/Navigational Structure/LeftSidebarView.swift index 4859153..76cec7c 100644 --- a/Shared/Navigational Structure/LeftSidebarView.swift +++ b/Shared/Navigational Structure/LeftSidebarView.swift @@ -125,6 +125,7 @@ struct LeftSidebarView: View { if let organization = try? await orgService.retrieveOrganisation() { DispatchQueue.main.async { orgService.organization = organization + orgService.getOrganisation() } } }