Skip to content

Commit

Permalink
kao-logic: Do not treat readyState 2 & 4 as error
Browse files Browse the repository at this point in the history
Signed-off-by: Dicky Herlambang (花) <herlambangdicky5@gmail.com>
  • Loading branch information
Nicklas373 committed May 12, 2024
1 parent 88734f9 commit 65012a8
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions resources/js/kao-logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -848,15 +848,20 @@ function apiGateway(proc, action) {
sendToAPI(files,proc,action).then(function () {
loadingModal.hide()
}).catch(function (error) {
errModal.hide()
errMessage.innerText = "There was unexpected error !"
errSubMessage.innerText = ""
errListTitleMessage.innerText = "Error message"
resetErrListMessage()
generateMesssage(error.xhrRequestStatus+" - "+error.xhrRequestMessage)
errAltSubMessageModal.style = null
loadingModal.hide()
errModal.show()
if (error.xhrRequestStatus == 2 || error.xhrRequestStatus == 4) {
// Do not treat this status as error
loadingModal.hide()
} else {
errModal.hide()
errMessage.innerText = "There was unexpected error !"
errSubMessage.innerText = ""
errListTitleMessage.innerText = "Error message"
resetErrListMessage()
generateMesssage(error.xhrRequestStatus+" - "+error.xhrRequestMessage)
errAltSubMessageModal.style = null
loadingModal.hide()
errModal.show()
}
})
}

Expand Down Expand Up @@ -1169,7 +1174,7 @@ function sendToAPI(files, proc, action) {
xhrRequestCondition: 'ERROR',
xhrRequestMessage: 'Server are not in readyState ! ('+xhr.readyState+')',
xhrRequestServerMessage: '',
xhrRequestStatus: 0
xhrRequestStatus: xhr.readyState
})
}
}
Expand Down

0 comments on commit 65012a8

Please sign in to comment.