This commit is contained in:
Aakiyaru 2025-05-27 14:16:58 +07:00
parent e3ea9b9fcb
commit 47580e8290
2 changed files with 4 additions and 1 deletions

View File

@ -8,6 +8,8 @@ public final class BaseNetworkService: BaseNetworkServiceProtocol {
public var baseURL: String? public var baseURL: String?
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) async throws -> Data {
guard let baseURL = baseURL else { guard let baseURL = baseURL else {
fatalError("Error baseURL") fatalError("Error baseURL")

View File

@ -11,10 +11,11 @@ public final class NetworkUser: NetworkUserProtocol {
let baseUrl: BaseNetworkServiceProtocol let baseUrl: BaseNetworkServiceProtocol
init(baseUrl: BaseNetworkServiceProtocol) { public init(baseUrl: BaseNetworkServiceProtocol) {
self.baseUrl = baseUrl self.baseUrl = baseUrl
} }
public func login(identity: String, password: String) async throws -> ServerResponseAuth { public func login(identity: String, password: String) async throws -> ServerResponseAuth {
let data = try await baseUrl.execute(path: URLS.login, method: .post, headers: Headers.headers(), parameters: [ let data = try await baseUrl.execute(path: URLS.login, method: .post, headers: Headers.headers(), parameters: [
"identity": identity, "identity": identity,