Skip to content

Commit

Permalink
feat/#8: 로그인 signIn network 상태 관리 위임하여 관리하는 기능 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
kangyein9892 committed Nov 15, 2024
1 parent 10a14cf commit bc6eceb
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,30 @@ class NetworkDelegate @Inject constructor() {
_networkState.value = NetworkState.Error(updatedException.title, updatedException.message)
}

fun handleSignInError(exception: NetworkError) {
val updatedException = when(exception){
is HttpCodeError -> {
when(exception.title) {
"400" -> HttpCodeError(
"요청에 문제가 있습니다. ",
if (exception.message == "01") "유효하지 못한 요청입니다." else "id 혹은 password가 틀렸습니다."
)
"403" -> HttpCodeError(
"요청에 문제가 있습니다. ",
"password가 틀렸습니다."
)
"404" -> HttpCodeError(
"요청에 문제가 있습니다. ",
"유효하지 못한 요청입니다."
)
else -> UnknownError
}
}
else -> exception
}
_networkState.value = NetworkState.Error(updatedException.title, updatedException.message)
}


fun handleNetworkSuccess(){
_networkState.value = NetworkState.Success
Expand Down

0 comments on commit bc6eceb

Please sign in to comment.