Skip to content

Commit

Permalink
kao-logic: minor updates
Browse files Browse the repository at this point in the history
- Fixup issue with HTMLToPDF while submit PDF
- Implement new error response for too many request from BE module
- Misc fixes and cleanup

Signed-off-by: Dicky Herlambang (花) <herlambangdicky5@gmail.com>
  • Loading branch information
Nicklas373 committed Apr 21, 2024
1 parent 314aa51 commit b582764
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions resources/js/kao-logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ var xhrTotalUploads = 0
if (procBtn) {
remainingBalance().then(function () {
procBtn.onclick = function(event) {
if (xhrScsUploads > 0 && xhrTotalUploads > 0) {
if (document.getElementById('html') !== null) {
submit(event)
} else if (xhrScsUploads > 0 && xhrTotalUploads > 0) {
if (xhrScsUploads == xhrTotalUploads) {
submit(event)
} else {
Expand Down Expand Up @@ -83,7 +85,7 @@ if (procBtn) {
errSubMessage.innerText = ""
errListTitleMessage.innerText = "Error message"
resetErrListMessage()
generateMesssage("Cannot establish connection with the server")
generateMesssage(error)
errAltSubMessageModal.style = null
loadingModal.hide()
errModal.show()
Expand Down Expand Up @@ -1829,6 +1831,9 @@ function remainingBalance() {
xhrBalanceRemaining = 0
}
resolve()
} else if (xhr.status == 429) {
xhrBalance = false
reject(new Error('Too many request'))
} else {
xhrBalance = false
reject(new Error('Failed to fetch monthly limit'))
Expand Down

0 comments on commit b582764

Please sign in to comment.