Skip to content

Commit 268e99f

Browse files
committed
style: switch문 케이스 수정
1 parent e6c1e58 commit 268e99f

2 files changed

Lines changed: 13 additions & 16 deletions

File tree

DevLog/Data/Repository/AuthDataRepositoryImpl.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,8 @@ private extension AuthDataRepositoryImpl {
9999
let nsError = error as NSError
100100
if nsError.domain == AuthErrorDomain,
101101
let authErrorCode = AuthErrorCode(rawValue: nsError.code) {
102-
switch authErrorCode {
103-
case .credentialAlreadyInUse:
102+
if authErrorCode == .credentialAlreadyInUse {
104103
return AuthError.linkCredentialAlreadyInUse
105-
default:
106-
break
107104
}
108105
}
109106

DevLog/Presentation/ViewModel/AccountViewModel.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -142,20 +142,20 @@ final class AccountViewModel: Store {
142142

143143
private extension AccountViewModel {
144144
func linkAlertType(for error: Error) -> AlertType {
145-
if let authError = error as? AuthError {
146-
switch authError {
147-
case .linkEmailNotFound:
148-
return .linkEmailNotFound
149-
case .linkEmailMismatch:
150-
return .linkEmailMismatch
151-
case .linkCredentialAlreadyInUse:
152-
return .linkCredentialAlreadyInUse
153-
default:
154-
break
155-
}
145+
guard let authError = error as? AuthError else {
146+
return .error
156147
}
157148

158-
return .error
149+
switch authError {
150+
case .linkEmailNotFound:
151+
return .linkEmailNotFound
152+
case .linkEmailMismatch:
153+
return .linkEmailMismatch
154+
case .linkCredentialAlreadyInUse:
155+
return .linkCredentialAlreadyInUse
156+
case .notAuthenticated, .failedToUnlinkLastProvider, .unsupportedProvider:
157+
return .error
158+
}
159159
}
160160

161161
func setAlert(_ state: inout State, isPresented: Bool, type: AlertType?) {

0 commit comments

Comments
 (0)