OBP 수수료 출력 연동시 에러 메세지 개선

This commit is contained in:
Rinjae
2025-12-22 18:00:16 +09:00
2 changed files with 179 additions and 90 deletions
@@ -431,9 +431,36 @@
return;
}
// 별도 창으로 청구서 출력 페이지 열기
const printUrl = '/commission/print/' + year + '/' + month;
window.open(printUrl, '_blank', 'width=800,height=900,scrollbars=yes,resizable=yes');
// 먼저 청구서 출력용 API로 데이터 조회하여 에러 여부 확인
fetch('/commission/print/check', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-XSRF-TOKEN': /*[[${_csrf.token}]]*/ ''
},
body: JSON.stringify({
year: year,
month: month
})
})
.then(response => {
return response.json().then(data => {
if (!response.ok) {
const errorMessage = data.description || data.message || '데이터 조회에 실패했습니다.';
throw new Error(errorMessage);
}
return data;
});
})
.then(data => {
// 에러가 없으면 청구서 출력 페이지 열기
const printUrl = '/commission/print/' + year + '/' + month;
window.open(printUrl, '_blank', 'width=800,height=900,scrollbars=yes,resizable=yes');
})
.catch(error => {
console.error('Error:', error);
customPopups.showAlert(error.message || '청구서 조회 중 오류가 발생했습니다.');
});
}
</script>
</th:block>