From bc6eceb2b9a7087b686882676fbe168965276af6 Mon Sep 17 00:00:00 2001 From: kangyein9892 Date: Fri, 15 Nov 2024 16:52:06 +0900 Subject: [PATCH] =?UTF-8?q?feat/#8:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20signIn?= =?UTF-8?q?=20network=20=EC=83=81=ED=83=9C=20=EA=B4=80=EB=A6=AC=20?= =?UTF-8?q?=EC=9C=84=EC=9E=84=ED=95=98=EC=97=AC=20=EA=B4=80=EB=A6=AC?= =?UTF-8?q?=ED=95=98=EB=8A=94=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/delegate/NetworkDelegate.kt | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/presentation/src/main/java/org/sopt/and/presentation/delegate/NetworkDelegate.kt b/presentation/src/main/java/org/sopt/and/presentation/delegate/NetworkDelegate.kt index 7dcb57f..7251a8d 100644 --- a/presentation/src/main/java/org/sopt/and/presentation/delegate/NetworkDelegate.kt +++ b/presentation/src/main/java/org/sopt/and/presentation/delegate/NetworkDelegate.kt @@ -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