wrap converters in promises

This commit is contained in:
C4illin 2024-05-25 18:09:28 +02:00
parent 7a9def556d
commit a41e5d8c99
8 changed files with 70 additions and 57 deletions

View file

@ -3,7 +3,7 @@ const fileInput = document.querySelector('input[type="file"]');
const fileNames = [];
let fileType;
const selectElem = document.querySelector("select[name='convert_to']");
const selectContainer = document.querySelector("form > article");
// const convertFromSelect = document.querySelector("select[name='convert_from']");
@ -46,9 +46,9 @@ fileInput.addEventListener("change", (e) => {
"Content-Type": "application/json",
},
})
.then((res) => res.text()) // Convert the response to text
.then((res) => res.text())
.then((html) => {
selectElem.outerHTML = html; // Set the HTML
selectContainer.innerHTML = html;
})
.catch((err) => console.log(err));
}