clean code

This commit is contained in:
MuslemRahimi 2024-08-02 17:55:01 +02:00
parent 3576827c1b
commit 66372f67a2
2 changed files with 4 additions and 5 deletions

View File

@ -42,6 +42,7 @@ const fetchWatchlist = async (fastifyURL, userId) => {
return output;
}
/*
async function fetchPortfolio(fastifyURL, userId)
{
const postData = {'userId': userId};
@ -58,6 +59,7 @@ async function fetchPortfolio(fastifyURL, userId)
return output
}
*/
export const load = async ({ params, locals, setHeaders}) => {
@ -71,7 +73,7 @@ export const load = async ({ params, locals, setHeaders}) => {
fetchData(apiURL,apiKey,'/stock-quote',params.tickerID),
fetchData(apiURL,apiKey,'/one-day-price',params.tickerID),
fetchWatchlist(fastifyURL, locals?.user?.id),
fetchPortfolio(fastifyURL, locals?.user?.id)
//fetchPortfolio(fastifyURL, locals?.user?.id)
];
const [
@ -79,7 +81,6 @@ export const load = async ({ params, locals, setHeaders}) => {
getStockQuote,
getOneDayPrice,
getUserWatchlist,
getUserPortfolio,
] = await Promise.all(promises);
@ -93,7 +94,6 @@ export const load = async ({ params, locals, setHeaders}) => {
getStockQuote,
getOneDayPrice,
getUserWatchlist,
getUserPortfolio,
companyName,
};

View File

@ -64,7 +64,7 @@ export const load = async ({ params, locals, cookies, setHeaders }) => {
const [
getSimilarStock, getStockDeck, getAnalystRating, getStockQuote,
getBullBearSay, getWhyPriceMoved, getTopETFHolder, getOneDayPrice,
getUserWatchlist, getUserPortfolio, getCommunitySentiment
getUserWatchlist, getCommunitySentiment
] = await Promise.all(promises);
setHeaders({ 'cache-control': 'public, max-age=300' });
@ -79,7 +79,6 @@ export const load = async ({ params, locals, cookies, setHeaders }) => {
getTopETFHolder,
getOneDayPrice,
getUserWatchlist,
getUserPortfolio,
getCommunitySentiment,
companyName: cleanString(getStockDeck?.[0]?.companyName),
};