if it aint empty, excute the function

This commit is contained in:
Justin 2023-08-02 21:32:00 +08:00 committed by GitHub
parent f23c03c69d
commit caf38275ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3349,43 +3349,45 @@ function scanNetworks() {
}
// UPLOAD CUSTOM STOCK LOGO
function uploadStockLogo() {
const fileInput_stocks = document.getElementById("stocks-logo-upload-browse");
const stock_file = fileInput_stocks.files[0];
const stock_upload_msg = document.getElementById("stocklogoupload");
if (fileInput_stocks.value !== "") {
const stock_file = fileInput_stocks.files[0];
const stock_upload_msg = document.getElementById("stocklogoupload");
const formData_stocks = new FormData();
formData_stocks.append('file', stock_file)
fetch('/upload_stocks', {
method: 'POST',
body: formData_stocks
})
stock_upload_msg.style.display = "block";
setTimeout(function hideElement() {
stock_upload_msg.style.display = "none";
}, 5000);
fileInput_stocks.value = "";
const formData_stocks = new FormData();
formData_stocks.append('file', stock_file)
fetch('/upload_stocks', {
method: 'POST',
body: formData_stocks
})
stock_upload_msg.style.display = "block";
setTimeout(function hideElement() {
stock_upload_msg.style.display = "none";
}, 5000);
fileInput_stocks.value = "";
}
}
// UPLOAD CUSTOM CRYPTO LOGO
function uploadCryptoLogo() {
const fileInput_crypto = document.getElementById("crypto-logo-upload-browse");
const crypto_file = fileInput_crypto.files[0];
const crypto_upload_msg = document.getElementById("cryptologoupload");
if (fileInput_crypto.value !== "") {
const crypto_file = fileInput_crypto.files[0];
const crypto_upload_msg = document.getElementById("cryptologoupload");
const formData_crypto = new FormData();
formData_crypto.append('file', crypto_file);
fetch('/upload_crypto', {
method: 'POST',
body: formData_crypto
})
crypto_upload_msg.style.display = "block";
setTimeout(function hideElement() {
crypto_upload_msg.style.display = "none";
}, 5000);
fileInput_crypto.value = "";
const formData_crypto = new FormData();
formData_crypto.append('file', crypto_file);
fetch('/upload_crypto', {
method: 'POST',
body: formData_crypto
});
crypto_upload_msg.style.display = "block";
setTimeout(function hideElement() {
crypto_upload_msg.style.display = "none";
}, 5000);
fileInput_crypto.value = "";
}
}