mirror of
https://github.com/writeas/writefreely-swiftui-multiplatform.git
synced 2024-11-15 01:11:02 +00:00
Handle errors on logout
This commit is contained in:
parent
01ba57ae75
commit
bf35738957
@ -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
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ struct AccountView: View {
|
|||||||
HStack {
|
HStack {
|
||||||
Spacer()
|
Spacer()
|
||||||
AccountLogoutView()
|
AccountLogoutView()
|
||||||
|
.withErrorHandling()
|
||||||
Spacer()
|
Spacer()
|
||||||
}
|
}
|
||||||
.padding()
|
.padding()
|
||||||
|
Loading…
Reference in New Issue
Block a user