From bf3573895726bfc69cde3fc44960b5d81d29a473 Mon Sep 17 00:00:00 2001 From: Angelo Stavrow Date: Sun, 8 May 2022 09:17:05 -0400 Subject: [PATCH] Handle errors on logout --- Shared/Account/AccountLogoutView.swift | 3 ++- Shared/Account/AccountView.swift | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Shared/Account/AccountLogoutView.swift b/Shared/Account/AccountLogoutView.swift index 22df2da..d972f70 100644 --- a/Shared/Account/AccountLogoutView.swift +++ b/Shared/Account/AccountLogoutView.swift @@ -2,6 +2,7 @@ import SwiftUI struct AccountLogoutView: View { @EnvironmentObject var model: WriteFreelyModel + @EnvironmentObject var errorHandling: ErrorHandling @State private var isPresentingLogoutConfirmation: Bool = false @State private var editedPostsWarningString: String = "" @@ -66,7 +67,7 @@ struct AccountLogoutView: View { editedPostsWarningString = "You'll lose unpublished changes to \(editedPosts.count) edited posts. " } } catch { - print("Error: failed to fetch cached posts") + self.errorHandling.handle(error: LocalStoreError.couldNotFetchPosts("cached")) } self.isPresentingLogoutConfirmation = true } diff --git a/Shared/Account/AccountView.swift b/Shared/Account/AccountView.swift index 0a2546e..5843048 100644 --- a/Shared/Account/AccountView.swift +++ b/Shared/Account/AccountView.swift @@ -9,6 +9,7 @@ struct AccountView: View { HStack { Spacer() AccountLogoutView() + .withErrorHandling() Spacer() } .padding()