-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAuthRepository.swift
More file actions
40 lines (33 loc) · 1.11 KB
/
AuthRepository.swift
File metadata and controls
40 lines (33 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//
// AuthRepository.swift
// Data
//
// Created by kimnahun on 1/21/26.
// Copyright © 2026 NDGL-iOS. All rights reserved.
//
import Domain
import Foundation
import Networks
public final class AuthRepository: AuthRepositoryProtocol, @unchecked Sendable {
private let authService: AuthServiceProtocol
public init(authService: AuthServiceProtocol) {
self.authService = authService
}
public func signup(info: SignupInfo) async -> Result<SignupResult, SignupError> {
let request = SignupRequest(fcmToken: info.fcmToken)
let result = await authService.signup(request: request)
switch result {
case .success(let response):
let signupResult = SignupResult(
uuid: response.uuid,
accessToken: response.accessToken,
nickname: response.nickname
)
return .success(signupResult)
case .failure(let error):
return .failure(error)
case .networkFailure(let networkError):
return .failure(.networkError(message: networkError.localizedDescription))
}
}
}