JSFiddle - React, Tailwind, and code Playground

by Exceeder

HTML

<div>
incospicuous
</div>
<div id="result">

</div>

JavaScript

window.support = {
  async auth(message) { 
    const hashBuffer = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(message));
    const hashArray = Array.from(new Uint8Array(hashBuffer));
    this.token = hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
  },

  query(sql) {
    fetch("/echo/json/", {
        method:"POST", 
        headers: { "Content-Type": "application/json" },
        body:JSON.stringify({
           json:[ {id:1,name:"test1"}, {id:2,name:"test2"}],
           delay: 1
           }),
        })
      .then(res => res.json())
      .then(json => {         
         document.querySelector("#result").innerHTML = JSON.stringify(json);
         console.log("echo result:",json);
         console.table(["a","b"]);
      })
      .catch(e => console.log(e));
   return "ok"   
  }
}