From 9215f4a9a210cb19a8077dfb9ce279ed64b36a5c Mon Sep 17 00:00:00 2001 From: dooohun Date: Wed, 10 Apr 2024 23:45:28 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EC=8B=9C?= =?UTF-8?q?=20=EB=B6=84=EA=B8=B0=EB=B3=84=EB=A1=9C=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/query/auth.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/query/auth.ts b/src/query/auth.ts index 12d895f0..ff1e2397 100644 --- a/src/query/auth.ts +++ b/src/query/auth.ts @@ -52,10 +52,21 @@ export const useLogin = () => { }, onError: (err: unknown) => { if (isKoinError(err)) { - // TODO: 분기별 에러 처리 + setLoginError(err.message || '로그인을 실패했습니다.'); + if (err.status === 401) { + setLoginError('비밀번호가 일치하지 않습니다.'); + } + if (err.status === 403) { + setLoginError('이메일 인증을 완료해주세요.'); + } + if (err.status === 404) { + setLoginError('가입되지 않은 이메일입니다.'); + } + if (err.status === 500) { + setLoginError('서버 오류가 발생했습니다.'); + } sessionStorage.removeItem('access_token'); localStorage.removeItem('refresh_token'); - setLoginError(err.message || '로그인에 실패했습니다.'); setLoginErrorCode(err.code); } },