Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat] #466 -회원가입 API 연동 #469

Merged
merged 8 commits into from
Jan 5, 2025
Prev Previous commit
Next Next commit
[Feat] #466 - PhoneVerify 관련 Service 구현
  • Loading branch information
meltsplit committed Dec 30, 2024
commit 619b670a3a4630ce8d6be8d9f1a1ae65a42f922a
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public struct SendVerificationCodeEntity: Encodable {

public init(name: String, phone: String, type: VerifyType) {
self.name = name
self.phone = phone
self.phone = phone.filter{ $0.isNumber }
self.type = type
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ extension BaseAPI {
case .fortune:
base += "/fortune"
case .coreAuth:
base = coreAuthBaseURL + "/auth"
base = coreAuthBaseURL + "/auth"
case .social:
base = coreAuthBaseURL + "/social"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//
// CoreAuthService.swift
// Networks
//
// Created by 장석우 on 12/30/24.
// Copyright © 2024 SOPT-iOS. All rights reserved.
//

import Foundation
import Combine

import Moya
import Core

public typealias DefaultCoreAuthService = BaseService<CoreAuthAPI>

public protocol CoreAuthService {
func sendVerifyCode(_ dto: SendVerificationCodeEntity) -> AnyPublisher<Int, Error>
func verifyCode(_ dto: VerifyCodeEntity) -> AnyPublisher<BaseEntity<VerifyResultEntity>, Error>
}

extension DefaultCoreAuthService: CoreAuthService {
public func sendVerifyCode(_ dto: SendVerificationCodeEntity) -> AnyPublisher<Int, Error> {
requestObjectInCombineNoResult(.sendVerifyCode(dto: dto))
}

public func verifyCode(_ dto: VerifyCodeEntity) -> AnyPublisher<BaseEntity<VerifyResultEntity>, Error> {
requestObjectInCombine(.verfiyCode(dto: dto))
}
}