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

[no] 로그인 실패 시 alert가 뜨지 않는 이슈 해결 #146

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sinzak.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3132,7 +3132,7 @@
repositoryURL = "https://github.com/onevcat/Kingfisher";
requirement = {
kind = upToNextMinorVersion;
minimumVersion = 7.5.0;
minimumVersion = 7.6.0;
};
};
A254E15229BE0413001047FD /* XCRemoteSwiftPackageReference "RxKeyboard" */ = {
Expand Down
7 changes: 4 additions & 3 deletions Sinzak/Scene/Login/VC/LoginVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ final class LoginVC: SZVC {
viewModel.errorHandler
.observe(on: MainScheduler.instance)
.bind(with: self, onNext: { owner, error in
Log.error(error)
if error is APIError {
let apiError = error as! APIError

Expand All @@ -144,15 +145,15 @@ final class LoginVC: SZVC {
case .badStatus(code: _):
owner.showSinglePopUpAlert(message: "알 수 없는 오류가 발생했습니다.")
default:
Log.error(error)
break
}
} else {
Log.error(error)
owner.showSinglePopUpAlert(message: "알 수 없는 오류가 발생했습니다.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기서 log만 찍어서 안보였던거 같습니다!

simpleErrorHandler
    .withUnretained(self)
    .observe(on: MainScheduler.instance)
    .subscribe(onNext: { owner, error in
        if error is APIError {
            let apiError = error as! APIError
            
            switch apiError {
            case .errorMessage(let message):
                owner.showSinglePopUpAlert(message: message)
            default:
                owner.showSinglePopUpAlert(message: "알 수 없는 오류가 발생했습니다.")
            }
        } else {
            owner.showSinglePopUpAlert(message: "알 수 없는 오류가 발생했습니다.")
        }
        Log.error(error)
    })
    .disposed(by: disposeBag)

SZVC에 simpleErrorHandler 라고 error가 errorMessage 인경우는 서버에서 전달해준 message 보여주고 이외에는 알 수 없는 오류 라고 alert 띄우는 relay 있습니다!

simpleErrorHandler 에 error 전달 해주는 방법으로 처리 해도 좋을거같아요!

}

self.hideLoading()

UserApi.shared.logout {(error) in
UserApi.shared.logout { (error) in
if let error = error {
Log.error(error)
} else {
Expand Down