From 47580e8290e67fcc1e94b9ed45447769fa102893 Mon Sep 17 00:00:00 2001 From: Aakiyaru Date: Tue, 27 May 2025 14:16:58 +0700 Subject: [PATCH] auth --- Sources/NetworkApi/Interfaces/BaseNetworkService.swift | 2 ++ Sources/NetworkApi/NetworkLayer/Auth/NetworkAuth.swift | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Sources/NetworkApi/Interfaces/BaseNetworkService.swift b/Sources/NetworkApi/Interfaces/BaseNetworkService.swift index 6d67907..38e0da8 100644 --- a/Sources/NetworkApi/Interfaces/BaseNetworkService.swift +++ b/Sources/NetworkApi/Interfaces/BaseNetworkService.swift @@ -8,6 +8,8 @@ public final class BaseNetworkService: BaseNetworkServiceProtocol { public var baseURL: String? + public init() {} + public func execute(path: String, method: HTTPMethod, headers: HTTPHeaders, parameters: Parameters) async throws -> Data { guard let baseURL = baseURL else { fatalError("Error baseURL") diff --git a/Sources/NetworkApi/NetworkLayer/Auth/NetworkAuth.swift b/Sources/NetworkApi/NetworkLayer/Auth/NetworkAuth.swift index e3d022e..3c8eea7 100644 --- a/Sources/NetworkApi/NetworkLayer/Auth/NetworkAuth.swift +++ b/Sources/NetworkApi/NetworkLayer/Auth/NetworkAuth.swift @@ -11,10 +11,11 @@ public final class NetworkUser: NetworkUserProtocol { let baseUrl: BaseNetworkServiceProtocol - init(baseUrl: BaseNetworkServiceProtocol) { + public init(baseUrl: BaseNetworkServiceProtocol) { self.baseUrl = baseUrl } + 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: [ "identity": identity,