Handle errors on logout

This commit is contained in:
Angelo Stavrow 2022-05-08 09:17:05 -04:00
parent 01ba57ae75
commit bf35738957
No known key found for this signature in database
GPG Key ID: 1A49C7064E060EEE
2 changed files with 3 additions and 1 deletions

View File

@ -2,6 +2,7 @@ import SwiftUI
struct AccountLogoutView: View { struct AccountLogoutView: View {
@EnvironmentObject var model: WriteFreelyModel @EnvironmentObject var model: WriteFreelyModel
@EnvironmentObject var errorHandling: ErrorHandling
@State private var isPresentingLogoutConfirmation: Bool = false @State private var isPresentingLogoutConfirmation: Bool = false
@State private var editedPostsWarningString: String = "" @State private var editedPostsWarningString: String = ""
@ -66,7 +67,7 @@ struct AccountLogoutView: View {
editedPostsWarningString = "You'll lose unpublished changes to \(editedPosts.count) edited posts. " editedPostsWarningString = "You'll lose unpublished changes to \(editedPosts.count) edited posts. "
} }
} catch { } catch {
print("Error: failed to fetch cached posts") self.errorHandling.handle(error: LocalStoreError.couldNotFetchPosts("cached"))
} }
self.isPresentingLogoutConfirmation = true self.isPresentingLogoutConfirmation = true
} }

View File

@ -9,6 +9,7 @@ struct AccountView: View {
HStack { HStack {
Spacer() Spacer()
AccountLogoutView() AccountLogoutView()
.withErrorHandling()
Spacer() Spacer()
} }
.padding() .padding()