wrap converters in promises
This commit is contained in:
parent
7a9def556d
commit
a41e5d8c99
8 changed files with 70 additions and 57 deletions
|
|
@ -16,12 +16,10 @@ const main = document.querySelector("main");
|
|||
const progressElem = document.querySelector("progress");
|
||||
|
||||
const refreshData = () => {
|
||||
console.log("Refreshing data...");
|
||||
console.log(progressElem.value);
|
||||
console.log(progressElem.max);
|
||||
|
||||
if (progressElem.value !== progressElem.max) {
|
||||
fetch(`/progress/${jobId}`)
|
||||
fetch(`/progress/${jobId}`, {
|
||||
method: "POST",
|
||||
})
|
||||
.then((res) => res.text())
|
||||
.then((html) => {
|
||||
main.innerHTML = html;
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue