made it async using fetch/await
authorArt Cancro <ajc@citadel.org>
Fri, 13 Aug 2021 00:38:21 +0000 (20:38 -0400)
committerArt Cancro <ajc@citadel.org>
Fri, 13 Aug 2021 00:38:21 +0000 (20:38 -0400)
webcit/static/t/aide/siteconfig/tab_aliases.html

index 02ed6b9..1e78cb8 100644 (file)
@@ -7,22 +7,16 @@
 
 <script type="text/javascript">
 
 
 <script type="text/javascript">
 
-
-function load_aliases() {
-       var request77 = new XMLHttpRequest();
-       request77.open("GET", "ajax_servcmd?g_cmd=LIST", true);
-       request77.onreadystatechange = function() {
-               populate_aliases(this.responseText);
-       };
-       request77.send();
-       request77 = null;
-}
+load_aliases = async() => {
+       response = await fetch("ajax_servcmd?g_cmd=LIST");
+       data = await(response.text());
+       populate_aliases(data);
+};
 
 function populate_aliases(data) {
        document.getElementById("wc_easterbunny77").innerHTML = data;
 }
 
 
 function populate_aliases(data) {
        document.getElementById("wc_easterbunny77").innerHTML = data;
 }
 
-
 document.getElementById("wc_easterbunny77").innerHTML = "die easterbunny die easterbunny still fool";
 load_aliases();
 
 document.getElementById("wc_easterbunny77").innerHTML = "die easterbunny die easterbunny still fool";
 load_aliases();