Show error message when preview fails

This commit is contained in:
RunasSudo 2020-07-23 22:31:12 +10:00
parent badc2a452f
commit 6861a6dd97
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A

View File

@ -23,7 +23,11 @@ document.querySelectorAll('.tooltip.xref').forEach(function(el) {
var xhr = new XMLHttpRequest();
xhr.addEventListener('load', function() {
if (xhr.status == 200) {
el.querySelector('.tooltip-content').innerHTML = xhr.responseText;
} else {
el.querySelector('.tooltip-content').innerHTML = 'Error';
}
})
xhr.open('GET', '/preview/' + el.dataset['xref']);
xhr.send();