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

View File

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