fetch crypto and stock portfolio values

This commit is contained in:
Justin 2023-07-11 17:04:29 +08:00 committed by GitHub
parent 356546558e
commit a5e30dfc1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2827,64 +2827,70 @@ function updateSelectedMsg(){
// get stock portfolio values // get stock portfolio values
function getStockSymbol(value) { function getStockSymbol(value) {
let stock_symbol = value; let stock_symbol = value;
const stock_thing = document.getElementById("inputText3"); const stock_thing = document.getElementById("inputText3");
// const the_msg = document.getElementById("inputText14"); const stock_shares = document.getElementById("inputText8");
// const t_color = document.getElementById("inputScrollSpeed16"); const stock_cost = document.getElementById("inputText9");
// const b_color = document.getElementById("inputScrollSpeed19"); const stock_date = document.getElementById("inputText10");
// const t_size = document.getElementById("inputScrollSpeed17"); const stock_portfolio_check = document.getElementById("flexCheckChecked4");
stock_thing.value = stock_symbol; stock_thing.value = stock_symbol;
// fetch("/fetchCustomMsg", { if (stock_portfolio_check.checked) {
// method: "POST", fetch("/fetchStockPortfolio", {
// body: JSON.stringify(messaged), method: "POST",
// }) body: JSON.stringify(stock_symbol),
// .then(response => response.json()) })
// .then(data => { .then(response => response.json())
// // Update the elements with the retrieved information .then(data => {
// the_msg.value = data.text; if (JSON.stringify(data) !== '{}') {
// t_color.value = data.text_colour; // Update the elements with the retrieved information
// b_color.value = data.background_colour; stock_shares.value = data.shares;
// t_size.value = data.size; stock_cost.value = data.cost;
// theIndexOfMsg = data.index; stock_date.value = data.day;
// }) } else {
// .catch(error => { stock_shares.value = '';
// console.error('Error:', error); stock_cost.value = '';
// }); stock_date.value = '';
} }
})
.catch(error => {
console.error('Error:', error);
});
}}
// get crypto portfolio values // get crypto portfolio values
function getCryptoSymbol(value) { function getCryptoSymbol(value) {
let crypto_symbol = value; let crypto_symbol = value;
const crypto_thing = document.getElementById("inputText4"); const crypto_thing = document.getElementById("inputText4");
// const the_msg = document.getElementById("inputText14"); const crypto_shares = document.getElementById("cryptoshares");
// const t_color = document.getElementById("inputScrollSpeed16"); const crypto_cost = document.getElementById("cryptocost");
// const b_color = document.getElementById("inputScrollSpeed19"); const crypto_date = document.getElementById("cryptodate");
// const t_size = document.getElementById("inputScrollSpeed17"); const crypto_portfolio_check = document.getElementById("crypto_portfolio_checkbox");
crypto_thing.value = crypto_symbol; crypto_thing.value = crypto_symbol;
// fetch("/fetchCustomMsg", { if (crypto_portfolio_check.checked) {
// method: "POST", fetch("/fetchCryptoPortfolio", {
// body: JSON.stringify(messaged), method: "POST",
// }) body: JSON.stringify(crypto_symbol),
// .then(response => response.json()) })
// .then(data => { .then(response => response.json())
// // Update the elements with the retrieved information .then(data => {
// the_msg.value = data.text; if (JSON.stringify(data) !== '{}') {
// t_color.value = data.text_colour; // Update the elements with the retrieved information
// b_color.value = data.background_colour; crypto_shares.value = data.shares;
// t_size.value = data.size; crypto_cost.value = data.cost;
// theIndexOfMsg = data.index; crypto_date.value = data.day;
// }) } else {
// .catch(error => { crypto_shares.value = '';
// console.error('Error:', error); crypto_cost.value = '';
// }); crypto_date.value = '';
} }
})
.catch(error => {
console.error('Error:', error);
});
}}