This commit is contained in:
Rudis Muiznieks 2023-09-25 16:36:08 -05:00
parent 1cbbc95856
commit 19af1022da
Signed by: rudism
GPG Key ID: CABF2F86EF7884F9
1 changed files with 11 additions and 5 deletions

View File

@ -26,7 +26,7 @@ function summarizeButtonClick(button) {
var container = button.parentNode;
container.classList.add('alert');
container.classList.add('alert-warning');
container.classList.add('alert-warn');
container.innerHTML = loadingMsg;
var request = new XMLHttpRequest();
@ -47,14 +47,20 @@ function summarizeButtonClick(button) {
return request.onerror(e);
}
container.classList.remove('alert-warning');
if (response.response.error) {
container.classList.remove('alert-warn');
container.classList.add('alert-error');
} else {
container.classList.remove('alert-warn');
container.classList.add('alert-success');
container.innerHTML = response.response.output_text.replace('\n', '<br>');
}
container.innerHTML = response.response.output_text;
}
request.onerror = function(e) {
badAjax(this.status == 403);
container.classList.remove('alert-warning');
container.classList.remove('alert-warn');
container.classList.add('alert-error');
container.innerHTML = errorMsg;
}