mirror of
https://github.com/yattee/yattee.git
synced 2024-12-23 22:13:41 +00:00
Add account error alerts
This commit is contained in:
parent
3fb2c532ee
commit
5ab2490b08
@ -66,8 +66,12 @@ final class InvidiousAPI: Service, ObservableObject, VideosAPI {
|
|||||||
.onSuccess { _ in
|
.onSuccess { _ in
|
||||||
self.signedIn = true
|
self.signedIn = true
|
||||||
}
|
}
|
||||||
.onFailure { _ in
|
.onFailure { requestError in
|
||||||
self.signedIn = false
|
self.signedIn = false
|
||||||
|
NavigationModel.shared.presentAlert(
|
||||||
|
title: "Could not connect with your account",
|
||||||
|
message: "\(requestError.httpStatusCode ?? -1) - \(requestError.userMessage)\nIf this issue persists, try removing and adding your account again in Settings."
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,6 +121,13 @@ final class PipedAPI: Service, ObservableObject, VideosAPI {
|
|||||||
)
|
)
|
||||||
.onSuccess { response in
|
.onSuccess { response in
|
||||||
self.account.token = response.json.dictionaryValue["token"]?.string ?? ""
|
self.account.token = response.json.dictionaryValue["token"]?.string ?? ""
|
||||||
|
if let error = response.json.dictionaryValue["error"]?.string {
|
||||||
|
NavigationModel.shared.presentAlert(
|
||||||
|
title: "Could not connect with your account",
|
||||||
|
message: error
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
self.configure()
|
self.configure()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,8 @@ import Foundation
|
|||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
final class NavigationModel: ObservableObject {
|
final class NavigationModel: ObservableObject {
|
||||||
|
static var shared: NavigationModel!
|
||||||
|
|
||||||
enum TabSelection: Hashable {
|
enum TabSelection: Hashable {
|
||||||
case favorites
|
case favorites
|
||||||
case subscriptions
|
case subscriptions
|
||||||
|
@ -226,6 +226,8 @@ struct YatteeApp: App {
|
|||||||
|
|
||||||
navigation.tabSelection = section ?? .search
|
navigation.tabSelection = section ?? .search
|
||||||
|
|
||||||
|
NavigationModel.shared = navigation
|
||||||
|
|
||||||
subscriptions.load()
|
subscriptions.load()
|
||||||
playlists.load()
|
playlists.load()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user