Update iOS ApiClient to handle token refresh

This commit is contained in:
advplyr
2025-07-05 16:46:37 -05:00
parent bc927d4c35
commit 5766c49f61
4 changed files with 393 additions and 22 deletions
+13
View File
@@ -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()