Skip to content

Commit

Permalink
fix rendering data bug
Browse files Browse the repository at this point in the history
  • Loading branch information
baxiry committed Oct 12, 2024
1 parent 7a766ee commit e40fb64
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions static/shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,24 @@ queryInput.addEventListener('keydown', function(event) {

// render response data
function HandleResponse(response) {
$('#examples').hide();
$('#examples').html("<div><div>");
$('#data').html("<div><div>");
if (response == "") {
//$("#data").remove();

if (response === "") {
$('#data').html(`<pre><span>null</span></pre>`);
$('#data').fadeIn(400);
return;
}

if (pretty) {
let Data = prettyJSON(response)
$('#data').html(`<pre><span>${Data}</span></pre>`);
let data = prettyJSON(response)
$('#data').html(`<pre><span>${data}</span></pre>`);
$('#data').fadeIn(400);
return;
}

data = JSON.parse(response);
let data = JSON.parse(response);
if (!Array.isArray(data)) {
let obj = JSON.stringify(data)
$('#data').append(`<pre><span>${obj}</span></pre>`);
Expand Down

0 comments on commit e40fb64

Please sign in to comment.