From cb44fae63eb7c2fd8c47748577864f04f10f1237 Mon Sep 17 00:00:00 2001 From: Justin Date: Wed, 2 Aug 2023 21:14:24 +0800 Subject: [PATCH] upload stocks and crypto logos --- static/app.js | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/static/app.js b/static/app.js index 4ec6dd1..a12add3 100755 --- a/static/app.js +++ b/static/app.js @@ -3348,3 +3348,44 @@ 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"); + + 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"); + + 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 = ""; +} +