diff --git a/front/src/main/resources/templates/common/components.html b/front/src/main/resources/templates/common/components.html index 9e5e5eb1..90c4c77e 100644 --- a/front/src/main/resources/templates/common/components.html +++ b/front/src/main/resources/templates/common/components.html @@ -25,6 +25,7 @@ + diff --git a/front/src/main/resources/templates/info/user/user.html b/front/src/main/resources/templates/info/user/user.html index 7c444527..5671e4ae 100644 --- a/front/src/main/resources/templates/info/user/user.html +++ b/front/src/main/resources/templates/info/user/user.html @@ -333,24 +333,22 @@ // selectboxInstance1.setValue($('input[name=regionMainCode]').val()); }, confirmPopup() { + // 이름 변경 여부 처리 const currentName = document.querySelector('input[name="ownerName"]').value.trim(); + const isNameChanged = currentName !== ENV.initialOwnerName; - if (currentName === '') { // 이름 비어있을 경우 유효성검사 실시 - formControl.updateUserInfo(); - } else if (currentName !== ENV.initialOwnerName) { // 이름이 변경됐을 경우 개인정보동의 모달창 띄우기 - ENV.module.confirmPopup.open(); - } else { - formControl.updateUserInfo(); - } + formControl.updateUserInfo(isNameChanged); }, confirmPopupOk() { ENV.module.confirmPopup.close(); - setTimeout(function () { - formControl.updateUserInfo(); + setTimeout(() => { + ajaxUtil._alert('개인정보 변경이 완료되었습니다.', null, () => { + location.href = '/info'; + }); }, 500); }, - updateUserInfo() { + updateUserInfo(showPopupIfValidNameChanged = false) { const f = document.reqForm; // // TODO 어쩔수 없이 이렇게 하는데..... 콤포넌트값 핸들링 방법 UX에서 지정하면 수정해야함. @@ -386,14 +384,13 @@ obj, function (rstData, status) { if (rstData.code === 'SUCCESS') { - ajaxUtil._alert('개인정보 변경이 완료되었습니다.', null, function () { - /** - * TODO - * 내정보에서만 들어온다는 가정하에서 back을 하게함 SB에는 내정보로 이동하게 되어 있음. - */ - // history.back(); + // 유효성 검사를 모두 통과한 후 + if (showPopupIfValidNameChanged) { + // 이름이 바뀐 경우만 팝업 + ENV.module.confirmPopup.open(); + } else { location.href = '/info'; - }); + } } else if (rstData.code === 'ERROR') { ajaxUtil._alert('잠시 뒤에 다시 시도해 주세요.', null); }