Skip to content
This repository has been archived by the owner on Jan 6, 2024. It is now read-only.

Commit

Permalink
refactor: 비밀번호 찾기 에러 message 개선 #82
Browse files Browse the repository at this point in the history
- SignInError 생성
  • Loading branch information
llghdud921 committed Jul 25, 2022
1 parent ab23783 commit 348713e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 11 deletions.
19 changes: 19 additions & 0 deletions Weekand/Weekand/Networking/Error/SignInError.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// SignInError.swift
// Weekand
//
// Created by 이호영 on 2022/07/26.
//

import Foundation

enum SignInError {
case noExistUser

var serverDescription: String {
switch self {
case .noExistUser:
return "존재하지 않는 유저입니다."
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class PasswordFindViewModel: ViewModelType {

input.confirmButtonDidTapEvent
.withLatestFrom(input.emailTextFieldDidEditEvent)
.distinctUntilChanged { $0 == $1 }
.throttle(.seconds(4), latest: false, scheduler: MainScheduler.instance)
.map(vaildEmail)
.subscribe(onNext: { email, isVaild in
if isVaild {
Expand Down Expand Up @@ -77,16 +77,16 @@ extension PasswordFindViewModel {
func issueTempPassword(email: String) {
self.signInUseCase.issueTempPassword(email: email)
.subscribe(onSuccess: { isSucceed in
if isSucceed {
self.coordinator?.presentPopViewController(
titleText: "안내",
informText: "임시비밀번호가 발급되었습니다.",
dismissParentCoordinator: true)
} else {
self.coordinator?.showToastMessage(text: "가입되지 않은 이메일입니다")
}
}, onFailure: { _ in
self.coordinator?.showToastMessage(text: "네트워크 요청에 실패하였습니다")
self.coordinator?.presentPopViewController(
titleText: "안내",
informText: "임시비밀번호가 발급되었습니다.",
dismissParentCoordinator: true)
}, onFailure: { error in
if error.localizedDescription == SignInError.noExistUser.serverDescription {
self.coordinator?.showToastMessage(text: "가입되지 않은 이메일입니다")
} else {
self.coordinator?.showToastMessage(text: "네트워크 요청에 실패하였습니다")
}
}, onDisposed: nil)
.disposed(by: disposeBag)
}
Expand Down

0 comments on commit 348713e

Please sign in to comment.