From 28b0f19619da387a9132306f323644312276f533 Mon Sep 17 00:00:00 2001 From: avalin Date: Sat, 1 Jun 2024 11:31:58 +0200 Subject: [PATCH] Fix bet confirmation --- Sources/Api/Sources/Api/UserApiManager.swift | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/Sources/Api/Sources/Api/UserApiManager.swift b/Sources/Api/Sources/Api/UserApiManager.swift index d5787ff..df39982 100644 --- a/Sources/Api/Sources/Api/UserApiManager.swift +++ b/Sources/Api/Sources/Api/UserApiManager.swift @@ -314,18 +314,12 @@ public struct UserApiManager: UserDataManager { request.httpMethod = "POST" request.setValue("application/json", forHTTPHeaderField: "Content-Type") request.setValue("Bearer \(token)", forHTTPHeaderField: "Authorization") - - let json: [String: String] = [ - "result": responseBet, - ] - - if let jsonData = try? JSONSerialization.data(withJSONObject: json, options: []){ - URLSession.shared.uploadTask(with: request, from: jsonData) { data, response, error in - print ("ALLIN : add response " + responseBet + " for the bet Id " + id) - if let httpResponse = response as? HTTPURLResponse { - print(httpResponse.statusCode) - } - }.resume() - } + + URLSession.shared.uploadTask(with: request, from: responseBet.data(using: .utf8)) { data, response, error in + print ("ALLIN : add response " + responseBet + " for the bet Id " + id) + if let httpResponse = response as? HTTPURLResponse { + print(httpResponse.statusCode) + } + }.resume() } }