mirror of
https://github.com/writeas/writefreely-swiftui-multiplatform.git
synced 2024-11-15 01:11:02 +00:00
Merge pull request #124 from writeas/fix-false-positive-on-login
Present error alert if token is invalid and ensure user is logged out
This commit is contained in:
commit
29aacd589e
@ -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