mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-30 15:17:14 +02:00
Update iOS ApiClient to handle token refresh
This commit is contained in:
@@ -61,6 +61,19 @@ class Database {
|
||||
setLastActiveConfigIndex(index: config.index)
|
||||
}
|
||||
}
|
||||
|
||||
public func updateServerConnectionConfigToken(newToken: String) {
|
||||
do {
|
||||
let realm = try Realm()
|
||||
if let config = realm.objects(ServerConnectionConfig.self).first(where: { $0.index == getLastActiveConfigIndex() }) {
|
||||
try realm.write {
|
||||
config.token = newToken
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
debugPrint("Failed to update server connection config token: \(error)")
|
||||
}
|
||||
}
|
||||
|
||||
public func deleteServerConnectionConfig(id: String) {
|
||||
let realm = try! Realm()
|
||||
|
||||
Reference in New Issue
Block a user