mirror of
https://github.com/writeas/writefreely-swiftui-multiplatform.git
synced 2024-11-15 01:11:02 +00:00
Present error alert if token is invalid and ensure user is logged out
This commit is contained in:
parent
81b4d38aea
commit
76089ef759
@ -325,6 +325,12 @@ private extension WriteFreelyModel {
|
||||
DispatchQueue.main.async {
|
||||
LocalStorageManager().saveContext()
|
||||
}
|
||||
} catch WFError.unauthorized {
|
||||
DispatchQueue.main.async {
|
||||
self.loginErrorMessage = "Something went wrong, please try logging in again."
|
||||
self.isPresentingLoginErrorAlert = true
|
||||
}
|
||||
self.logout()
|
||||
} catch {
|
||||
print(error)
|
||||
}
|
||||
@ -376,6 +382,12 @@ private extension WriteFreelyModel {
|
||||
} catch {
|
||||
print(error)
|
||||
}
|
||||
} catch WFError.unauthorized {
|
||||
DispatchQueue.main.async {
|
||||
self.loginErrorMessage = "Something went wrong, please try logging in again."
|
||||
self.isPresentingLoginErrorAlert = true
|
||||
}
|
||||
self.logout()
|
||||
} catch {
|
||||
print("Error: Failed to fetch cached posts")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user