From 4093ca354a30a8f5211d90ebfd7bab3ecc0967da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=A3=BC=EC=B0=AC?= Date: Sat, 28 Dec 2024 16:56:03 +0900 Subject: [PATCH] =?UTF-8?q?[=EC=A3=BC=EC=B0=AC]=20Feat=20:=20=EB=B9=84?= =?UTF-8?q?=EB=B0=80=EB=B2=88=ED=98=B8=20=EB=B3=80=EA=B2=BD=20=EC=9C=A0?= =?UTF-8?q?=ED=9A=A8=EC=84=B1=20=EA=B2=80=EC=82=AC=20=EB=B0=8F=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98=20=EC=8B=9C=20alert=EB=A1=9C=20=EB=82=B4=EC=97=AD=20?= =?UTF-8?q?=ED=99=95=EC=9D=B8=2012.28?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/user/MyPage.jsx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/pages/user/MyPage.jsx b/src/pages/user/MyPage.jsx index 8d1a164..e18fa23 100644 --- a/src/pages/user/MyPage.jsx +++ b/src/pages/user/MyPage.jsx @@ -162,6 +162,15 @@ const MyPage = () => { alert("인증 정보가 없습니다. 다시 로그인 해주세요."); return; } + if (passwordData.newPassword !== passwordData.confirmPassword) { + alert("새 비밀번호와 비밀번호 확인이 일치하지 않습니다."); + return; + } + + if (passwordData.newPassword.length < 8) { + alert("비밀번호는 최소 8글자 이상이어야 합니다."); + return; + } // 서버가 요구하는 파라미터(form-data/json 등)는 서버 로직에 맞춰서 수정하세요. await axios.put("http://localhost:8080/password/update", { @@ -178,7 +187,11 @@ const MyPage = () => { setIsChangingPassword(false); } catch (error) { console.error("비밀번호 변경 중 오류가 발생했습니다.", error); - alert("비밀번호 변경에 실패했습니다."); + if (error.response && error.response.data && error.response.data.message) { + alert(error.response.data.message); + } else { + alert("비밀번호 변경에 실패했습니다. 잠시 후 다시 시도해주세요."); + } } };