Skip to content

Commit

Permalink
feat :: 회원가입 alert 통과
Browse files Browse the repository at this point in the history
  • Loading branch information
DSMInhyeKang committed Mar 9, 2023
1 parent 16ba657 commit 553d572
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ final class SignupTermsViewModel: BaseViewModel {
) { [weak self] feature in
self?.dmsFeatures = feature
self?.isShowingAlert = true
print("thisis")
print(self?.dmsFeatures?.remainService ?? "failed parsing")
self?.alertMessage = "회원가입이 완료되었습니다!"
}
}
Expand Down
5 changes: 4 additions & 1 deletion Projects/Modules/ErrorModule/Sources/DmsError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public enum DmsError: Error {
case notFoundAccountID

// MARK: - Students
case unAuthorizedEmail
case alreadyExistUserBySignup
case alreadyExistIDByCheckID
case alreadyExistEmailByCheckEmail
Expand Down Expand Up @@ -86,7 +87,7 @@ extension DmsError: LocalizedError {
return "인증 정보를 찾을 수 없습니다."

case .diffrentEmailByAccountID:
return "아이디외 이메일과 일치하지 않습니다."
return "아이디와 이메일이 일치하지 않습니다."

case .notFoundAccountID:
return "존재하지 않는 아이디입니다."
Expand All @@ -95,6 +96,8 @@ extension DmsError: LocalizedError {
return "학생이 등록되지 않았습니다."

// MARK: - Students
case .unAuthorizedEmail:
return "이메일이 인증되지 않았습니다."

case .alreadyExistUserBySignup:
return "이미 회원가입한 학생합니다!"
Expand Down
2 changes: 2 additions & 0 deletions Projects/Services/APIKit/Sources/StudentsAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ extension StudentsAPI: DmsAPI {
case .signup:
return [
400: .badRequest,
401: .unAuthorizedEmail,
409: .alreadyExistUserBySignup,
429: .tooManyRequest,
500: .internalServerError
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ public struct SigninUseCaseFake: SigninUseCase {
public func execute(req: SigninRequestDTO) -> AnyPublisher<DmsFeatures, DmsError> {
if req.accountID == "baekteun" && req.password == "baekteun" {
return Just(DmsFeatures(
mealService: false,
noticeService: false,
pointService: false,
mealService: true,
noticeService: true,
pointService: true,
studyRoomService: false,
remainService: false
))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import Combine
import DataMappingModule
import DomainModule
import ErrorModule
import Foundation

public struct SignupUseCaseFake: SignupUseCase {
public init () {}

public func execute(req: SignupRequestDTO) -> AnyPublisher<DmsFeatures, DmsError> {
if req.accountID == "baekteun" && req.password == "baekteun" {
return Just(DmsFeatures(
mealService: true,
noticeService: true,
pointService: true,
studyRoomService: false,
remainService: false
))
.setFailureType(to: DmsError.self)
.delay(for: 1, scheduler: DispatchQueue.main)
.eraseToAnyPublisher()
} else {
return Fail(error: DmsError.passwordMismatch)
.delay(for: 1, scheduler: DispatchQueue.main)
.eraseToAnyPublisher()
}
}
}

0 comments on commit 553d572

Please sign in to comment.