From 917ca5846e7d9c1d13acb65d2c2829ef086122af Mon Sep 17 00:00:00 2001 From: Maurice Carrier Date: Thu, 25 Jul 2024 16:52:59 -0400 Subject: [PATCH] Update TokenRequest.swift --- Palace/SignInLogic/TokenRequest.swift | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/Palace/SignInLogic/TokenRequest.swift b/Palace/SignInLogic/TokenRequest.swift index c687bb724..0d1e1ea55 100644 --- a/Palace/SignInLogic/TokenRequest.swift +++ b/Palace/SignInLogic/TokenRequest.swift @@ -48,28 +48,9 @@ import Foundation let base64LoginString = loginData.base64EncodedString() request.addValue("Basic \(base64LoginString)", forHTTPHeaderField: "Authorization") -// do { -// let (data, _) = try await URLSession.shared.data(for: request) -// -// let decoder = JSONDecoder() -// decoder.keyDecodingStrategy = .convertFromSnakeCase -// let tokenResponse = try decoder.decode(TokenResponse.self, from: data) -// return .success(tokenResponse) -// } catch { -// return .failure(error) -// } do { let (data, _) = try await URLSession.shared.data(for: request) - - // Pretty print the JSON data - if let jsonObject = try? JSONSerialization.jsonObject(with: data, options: []), - let jsonData = try? JSONSerialization.data(withJSONObject: jsonObject, options: [.prettyPrinted]), - let jsonString = String(data: jsonData, encoding: .utf8) { - print("Pretty Printed JSON:\n\(jsonString)") - } else { - print("Failed to pretty print JSON") - } - + let decoder = JSONDecoder() decoder.keyDecodingStrategy = .convertFromSnakeCase let tokenResponse = try decoder.decode(TokenResponse.self, from: data)