refactor: 브라우저 alert를 showToast로 변경

- user-modal.js: 삭제/복원/비밀번호 초기화 알림 개선
- context-menu.js: 테넌트 전환/사용자 삭제 알림 개선
- 시스템 일관성을 위해 SweetAlert2 토스트 사용
This commit is contained in:
2025-12-17 15:44:31 +09:00
parent 6428c5a3bb
commit c383494d84
2 changed files with 13 additions and 10 deletions

View File

@@ -176,7 +176,7 @@ class ContextMenu {
form.submit();
} catch (error) {
console.error('Failed to switch tenant:', error);
alert('테넌트 전환에 실패했습니다.');
showToast('테넌트 전환에 실패했습니다.', 'error');
}
}
@@ -194,6 +194,7 @@ class ContextMenu {
const data = await response.json();
if (data.success) {
showToast(data.message || '사용자가 삭제되었습니다.', 'success');
// 테이블 새로고침
if (typeof htmx !== 'undefined') {
htmx.trigger('#user-table', 'filterSubmit');
@@ -201,11 +202,11 @@ class ContextMenu {
window.location.reload();
}
} else {
alert(data.message || '삭제에 실패했습니다.');
showToast(data.message || '삭제에 실패했습니다.', 'error');
}
} catch (error) {
console.error('Failed to delete user:', error);
alert('삭제에 실패했습니다.');
showToast('삭제에 실패했습니다.', 'error');
}
}
}

View File

@@ -135,16 +135,17 @@ const UserModal = {
if (data.success) {
this.close();
showToast(data.message || '사용자가 삭제되었습니다.', 'success');
// 테이블 새로고침
if (typeof htmx !== 'undefined') {
htmx.trigger('#user-table', 'filterSubmit');
}
} else {
alert(data.message || '삭제에 실패했습니다.');
showToast(data.message || '삭제에 실패했습니다.', 'error');
}
} catch (error) {
console.error('Failed to delete user:', error);
alert('삭제에 실패했습니다.');
showToast('삭제에 실패했습니다.', 'error');
}
}
},
@@ -168,6 +169,7 @@ const UserModal = {
const data = await response.json();
if (data.success) {
showToast(data.message || '사용자가 복원되었습니다.', 'success');
// 모달 내용 새로고침
await this.loadUserInfo();
// 테이블 새로고침
@@ -175,11 +177,11 @@ const UserModal = {
htmx.trigger('#user-table', 'filterSubmit');
}
} else {
alert(data.message || '복원에 실패했습니다.');
showToast(data.message || '복원에 실패했습니다.', 'error');
}
} catch (error) {
console.error('Failed to restore user:', error);
alert('복원에 실패했습니다.');
showToast('복원에 실패했습니다.', 'error');
}
}
},
@@ -207,13 +209,13 @@ const UserModal = {
const data = await response.json();
if (data.success) {
alert(data.message || '비밀번호가 초기화되었습니다.');
showToast(data.message || '비밀번호가 초기화되었습니다.', 'success');
} else {
alert(data.message || '비밀번호 초기화에 실패했습니다.');
showToast(data.message || '비밀번호 초기화에 실패했습니다.', 'error');
}
} catch (error) {
console.error('Failed to reset password:', error);
alert('비밀번호 초기화에 실패했습니다.');
showToast('비밀번호 초기화에 실패했습니다.', 'error');
}
}
};