feat: ios mobil arayüz tasarımı

This commit is contained in:
2026-02-11 18:06:35 +03:00
parent 69884db0ab
commit 261b2f58cc
42 changed files with 2501 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
import Foundation
struct AuthResponse: Codable {
struct User: Codable {
let id: String
let email: String
}
let token: String
let user: User
}
protocol AuthServiceProtocol {
func login(email: String, password: String) async throws -> AuthResponse
func register(email: String, password: String) async throws -> AuthResponse
func profile(token: String) async throws -> UserProfile
}
final class AuthService: AuthServiceProtocol {
private let client: APIClientProtocol
init(client: APIClientProtocol) {
self.client = client
}
func login(email: String, password: String) async throws -> AuthResponse {
try await client.post(path: "api/auth/login", body: Credentials(email: email, password: password), token: nil)
}
func register(email: String, password: String) async throws -> AuthResponse {
try await client.post(path: "api/auth/register", body: Credentials(email: email, password: password), token: nil)
}
func profile(token: String) async throws -> UserProfile {
try await client.get(path: "api/auth/profile", queryItems: [], token: token)
}
}
private struct Credentials: Codable {
let email: String
let password: String
}