auth
This commit is contained in:
parent
9e25357a56
commit
fe8f570fd0
@ -10,7 +10,7 @@ public final class BaseNetworkService: BaseNetworkServiceProtocol {
|
|||||||
|
|
||||||
public init() {}
|
public init() {}
|
||||||
|
|
||||||
public func execute(path: String, method: HTTPMethod, headers: HTTPHeaders, parameters: Parameters) async throws -> Data {
|
public func execute(path: String, method: HTTPMethod, headers: HTTPHeaders, parameters: Parameters? = nil) async throws -> Data {
|
||||||
guard let baseURL = baseURL else {
|
guard let baseURL = baseURL else {
|
||||||
fatalError("Error baseURL")
|
fatalError("Error baseURL")
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,6 @@ import Alamofire
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public protocol BaseNetworkServiceProtocol {
|
public protocol BaseNetworkServiceProtocol {
|
||||||
func execute(path: String, method: HTTPMethod, headers: HTTPHeaders, parameters: Parameters) async throws -> Data
|
func execute(path: String, method: HTTPMethod, headers: HTTPHeaders, parameters: Parameters?) async throws -> Data
|
||||||
func configure(baseURL: String)
|
func configure(baseURL: String)
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ public final class NetworkUser: NetworkUserProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func getIdToken(token: String) async throws -> String {
|
public func getIdToken(token: String) async throws -> String {
|
||||||
let data = try await baseUrl.execute(path: URLS.getIdToken, method: .get, headers: Headers.headerWithToken(token: token), parameters: [:])
|
let data = try await baseUrl.execute(path: URLS.getIdToken, method: .get, headers: Headers.headerWithToken(token: token), parameters: nil)
|
||||||
let tokenID = try JSONDecoder().decode(ServerResponseIdToken.self, from: data)
|
let tokenID = try JSONDecoder().decode(ServerResponseIdToken.self, from: data)
|
||||||
return tokenID.items.id
|
return tokenID.items.id
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user