add loading
This commit is contained in:
+9
-1
@@ -271,6 +271,9 @@
|
|||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append('image', imageFile);
|
formData.append('image', imageFile);
|
||||||
|
|
||||||
|
btnSubmit.innerHTML = 'Loading...';
|
||||||
|
btnSubmit.setAttribute('disabled', true);
|
||||||
|
|
||||||
fetch('https://img-resize-xxx.herokuapp.com/', {
|
fetch('https://img-resize-xxx.herokuapp.com/', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {},
|
headers: {},
|
||||||
@@ -283,8 +286,13 @@
|
|||||||
: `?quality=${qualityValue}&width=${widthValue}&height=${heightValue}`;
|
: `?quality=${qualityValue}&width=${widthValue}&height=${heightValue}`;
|
||||||
anchorDonwload.setAttribute('href', result.urlImage + params);
|
anchorDonwload.setAttribute('href', result.urlImage + params);
|
||||||
anchorDonwload.click();
|
anchorDonwload.click();
|
||||||
|
btnSubmit.innerHTM = 'Submit & Download';
|
||||||
|
btnSubmit.removeAttribute('disabled');
|
||||||
})
|
})
|
||||||
.catch((err) => console.log(err));
|
.catch((err) => {
|
||||||
|
btnSubmit.innerHTM = 'Submit & Download';
|
||||||
|
btnSubmit.removeAttribute('disabled');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user