Skip to content

Commit

Permalink
Don't reset user token if baseURL didn't change
Browse files Browse the repository at this point in the history
  • Loading branch information
nighthawk committed Nov 28, 2023
1 parent f913e24 commit f26283d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Sources/TripKit/server/TKServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ public class TKServer {
UserDefaults.shared.string(forKey: "developmentServer")
}
set {
let newValue = newValue.map { value in
value.hasSuffix("/") ? value : value.appending("/")
}
let oldValue = customBaseURL
if var newValue = newValue, !newValue.isEmpty {
if !newValue.hasSuffix("/") {
newValue.append("/")
}
UserDefaults.shared.set(newValue, forKey: "developmentServer")
} else {
UserDefaults.shared.removeObject(forKey: "developmentServer")
Expand Down

0 comments on commit f26283d

Please sign in to comment.