diff --git a/src/lib/components/AddPortfolio.svelte b/src/lib/components/AddPortfolio.svelte index 233b518d..5ad67b3f 100644 --- a/src/lib/components/AddPortfolio.svelte +++ b/src/lib/components/AddPortfolio.svelte @@ -30,7 +30,7 @@ async function createPortfolio(event) { const response = await fetch(fastifyURL+'/create-portfolio', { method: 'POST', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json" }, body: JSON.stringify(postData) }); diff --git a/src/lib/components/AnalystEstimate.svelte b/src/lib/components/AnalystEstimate.svelte index b00ccf92..f3cde9e4 100644 --- a/src/lib/components/AnalystEstimate.svelte +++ b/src/lib/components/AnalystEstimate.svelte @@ -16,6 +16,7 @@ let isLoaded = false; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; userRegion.subscribe(value => { @@ -77,7 +78,7 @@ const getAnalystEstimate = async (ticker) => { const response = await fetch(apiURL + '/analyst-estimate', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); diff --git a/src/lib/components/AnalystInsight.svelte b/src/lib/components/AnalystInsight.svelte index db9343dc..91df4043 100644 --- a/src/lib/components/AnalystInsight.svelte +++ b/src/lib/components/AnalystInsight.svelte @@ -8,6 +8,8 @@ const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -52,7 +54,7 @@ function latestInfoDate(inputDate) { const response = await fetch(apiURL + '/analyst-insight', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); diff --git a/src/lib/components/BorrowedShare.svelte b/src/lib/components/BorrowedShare.svelte index 46759fdc..d7f6ea16 100644 --- a/src/lib/components/BorrowedShare.svelte +++ b/src/lib/components/BorrowedShare.svelte @@ -11,6 +11,8 @@ const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -191,7 +193,7 @@ function findLowestAndHighestFee(data, lastDateStr) { const response = await fetch(apiURL + '/borrowed-share', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); diff --git a/src/lib/components/BuyTrade.svelte b/src/lib/components/BuyTrade.svelte index 63c75a33..ae94a12b 100644 --- a/src/lib/components/BuyTrade.svelte +++ b/src/lib/components/BuyTrade.svelte @@ -104,7 +104,7 @@ const response = await fetch(fastifyURL+'/buy-stock', { method: 'POST', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json" }, body: JSON.stringify(postData) }); diff --git a/src/lib/components/ClinicalTrial.svelte b/src/lib/components/ClinicalTrial.svelte index b658fd76..3aabc34d 100644 --- a/src/lib/components/ClinicalTrial.svelte +++ b/src/lib/components/ClinicalTrial.svelte @@ -11,6 +11,8 @@ const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -173,7 +175,7 @@ const getClinicalTrial = async (ticker) => { const response = await fetch(apiURL + '/clinical-trial', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); diff --git a/src/lib/components/CommentSection.svelte b/src/lib/components/CommentSection.svelte index 37edef87..51cb7b77 100644 --- a/src/lib/components/CommentSection.svelte +++ b/src/lib/components/CommentSection.svelte @@ -118,7 +118,7 @@ const handleUpvote = async (event) => { const response = await fetch(fastifyURL+'/upvote-comment', { method: 'POST', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json" }, body: JSON.stringify(postData) }); // make a POST request to the server with the FormData object @@ -154,7 +154,7 @@ const handleDownvote = async (event) => { const response = await fetch(fastifyURL+'/downvote-comment', { method: 'POST', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json" }, body: JSON.stringify(postData) }); // make a POST request to the server with the FormData object @@ -204,7 +204,7 @@ const handleDownvote = async (event) => { const response = await fetch(fastifyURL+'/delete-comment', { method: 'POST', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json" }, body: JSON.stringify(postData) }); // make a POST request to the server with the FormData object diff --git a/src/lib/components/CommunitySentiment.svelte b/src/lib/components/CommunitySentiment.svelte index b8941479..3870b1a8 100644 --- a/src/lib/components/CommunitySentiment.svelte +++ b/src/lib/components/CommunitySentiment.svelte @@ -34,7 +34,7 @@ async function updateSentiment(sentiment:string) { const response = await fetch('/api/community-sentiment', { method: 'POST', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json","X-API-KEY": apiKey }, body: JSON.stringify(postData), }); // make a POST request to the server with the FormData object diff --git a/src/lib/components/Cookie.svelte b/src/lib/components/Cookie.svelte index be9a5d1c..44510434 100644 --- a/src/lib/components/Cookie.svelte +++ b/src/lib/components/Cookie.svelte @@ -9,7 +9,7 @@ async function cookieConsent(state:string) { const response = await fetch('/api/cookies', { method: 'POST', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json","X-API-KEY": apiKey }, body: JSON.stringify(postData), }); // make a POST request to the server with the FormData object diff --git a/src/lib/components/DarkPool.svelte b/src/lib/components/DarkPool.svelte index 53db5789..3d039295 100644 --- a/src/lib/components/DarkPool.svelte +++ b/src/lib/components/DarkPool.svelte @@ -11,6 +11,8 @@ const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -184,7 +186,7 @@ const getDarkPool = async (ticker) => { const response = await fetch(apiURL + '/dark-pool', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); diff --git a/src/lib/components/Enterprise.svelte b/src/lib/components/Enterprise.svelte index 5d0deb14..6ee33a42 100644 --- a/src/lib/components/Enterprise.svelte +++ b/src/lib/components/Enterprise.svelte @@ -12,6 +12,8 @@ const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -144,7 +146,7 @@ const getEnterPriseValues = async (ticker) => { const response = await fetch(apiURL + '/enterprise-values', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); diff --git a/src/lib/components/ExecutiveCard.svelte b/src/lib/components/ExecutiveCard.svelte index d02f6325..6d988417 100644 --- a/src/lib/components/ExecutiveCard.svelte +++ b/src/lib/components/ExecutiveCard.svelte @@ -10,6 +10,8 @@ const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion?.subscribe(value => { if (usRegion?.includes(value)) { @@ -38,7 +40,7 @@ async function fetchData() { const response = await fetch(apiURL+'/get-executives', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); diff --git a/src/lib/components/FailToDeliver.svelte b/src/lib/components/FailToDeliver.svelte index 1fc20386..7948583e 100644 --- a/src/lib/components/FailToDeliver.svelte +++ b/src/lib/components/FailToDeliver.svelte @@ -11,6 +11,8 @@ const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -185,7 +187,7 @@ function findLowestAndHighestPrice(data, lastDateStr) { const response = await fetch(apiURL + '/fail-to-deliver', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); diff --git a/src/lib/components/Feedback.svelte b/src/lib/components/Feedback.svelte index 3f7376a6..0db1112e 100644 --- a/src/lib/components/Feedback.svelte +++ b/src/lib/components/Feedback.svelte @@ -57,7 +57,7 @@ const response = await fetch(fastifyURL+'/feedback', { method: 'POST', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json" }, body: JSON.stringify(postData) }); diff --git a/src/lib/components/FundamentalAnalysis.svelte b/src/lib/components/FundamentalAnalysis.svelte index 7dc85cd2..34bc5863 100644 --- a/src/lib/components/FundamentalAnalysis.svelte +++ b/src/lib/components/FundamentalAnalysis.svelte @@ -8,6 +8,8 @@ const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -41,7 +43,7 @@ const getFundamentalAnalysis = async (ticker) => { const response = await fetch(apiURL + '/fundamental-predictor-analysis', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); diff --git a/src/lib/components/GovernmentContract.svelte b/src/lib/components/GovernmentContract.svelte index 5f11778f..8ddd4acd 100644 --- a/src/lib/components/GovernmentContract.svelte +++ b/src/lib/components/GovernmentContract.svelte @@ -11,6 +11,8 @@ const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -162,7 +164,7 @@ const response = await fetch(apiURL + '/government-contract', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); diff --git a/src/lib/components/ImpliedVolatility.svelte b/src/lib/components/ImpliedVolatility.svelte index 914ae790..2b09c610 100644 --- a/src/lib/components/ImpliedVolatility.svelte +++ b/src/lib/components/ImpliedVolatility.svelte @@ -11,6 +11,8 @@ const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -221,7 +223,7 @@ function findLowestAndhighestIV(data, lastDateStr) { const response = await fetch(apiURL + '/implied-volatility', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); diff --git a/src/lib/components/LoginPopup.svelte b/src/lib/components/LoginPopup.svelte index 538b8089..51fd3b7e 100644 --- a/src/lib/components/LoginPopup.svelte +++ b/src/lib/components/LoginPopup.svelte @@ -101,7 +101,7 @@ const formData = new FormData(event.target); // create a FormData object from th const response = await fetch('/api/register', { method: 'POST', headers: { -'Content-Type': 'application/json' +"Content-Type": "application/json","X-API-KEY": apiKey }, body: JSON.stringify(formData) }); diff --git a/src/lib/components/MarketMaker.svelte b/src/lib/components/MarketMaker.svelte index 27b4c13c..c70c4339 100644 --- a/src/lib/components/MarketMaker.svelte +++ b/src/lib/components/MarketMaker.svelte @@ -11,6 +11,8 @@ const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -169,7 +171,7 @@ const getMarketMaker = async (ticker) => { const response = await fetch(apiURL + '/market-maker', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); diff --git a/src/lib/components/MobileCommentEditor.svelte b/src/lib/components/MobileCommentEditor.svelte index d3776466..72355936 100644 --- a/src/lib/components/MobileCommentEditor.svelte +++ b/src/lib/components/MobileCommentEditor.svelte @@ -371,4 +371,4 @@ onDestroy(() => { touch-action: none; /* or 'none' if manipulation doesn't work */ } - + \ No newline at end of file diff --git a/src/lib/components/OptionsData.svelte b/src/lib/components/OptionsData.svelte index 55e1f609..81d830e6 100644 --- a/src/lib/components/OptionsData.svelte +++ b/src/lib/components/OptionsData.svelte @@ -9,6 +9,8 @@ export let data; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -59,7 +61,7 @@ const getOptionsBubble = async (ticker) => { const response = await fetch(apiURL + '/options-bubble', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); diff --git a/src/lib/components/OptionsNetFlow.svelte b/src/lib/components/OptionsNetFlow.svelte index 417f377a..0266cd4f 100644 --- a/src/lib/components/OptionsNetFlow.svelte +++ b/src/lib/components/OptionsNetFlow.svelte @@ -11,6 +11,8 @@ const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -176,7 +178,7 @@ const response = await fetch(apiURL + '/options-net-flow-ticker', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); diff --git a/src/lib/components/PriceAlert.svelte b/src/lib/components/PriceAlert.svelte index e8c13289..91a212c9 100644 --- a/src/lib/components/PriceAlert.svelte +++ b/src/lib/components/PriceAlert.svelte @@ -46,7 +46,7 @@ const response = await fetch(fastifyURL+'/create-price-alert', { method: 'POST', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json" }, body: JSON.stringify(postData) }); diff --git a/src/lib/components/PriceAnalysis.svelte b/src/lib/components/PriceAnalysis.svelte index f74df53d..2f52ef99 100644 --- a/src/lib/components/PriceAnalysis.svelte +++ b/src/lib/components/PriceAnalysis.svelte @@ -8,6 +8,8 @@ const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -149,7 +151,7 @@ const getPriceAnalysis = async (ticker) => { const response = await fetch(apiURL + '/price-analysis', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); diff --git a/src/lib/components/RetailVolume.svelte b/src/lib/components/RetailVolume.svelte index c8139cf9..4b6e3fd3 100644 --- a/src/lib/components/RetailVolume.svelte +++ b/src/lib/components/RetailVolume.svelte @@ -15,6 +15,8 @@ let historyData = []; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -210,7 +212,7 @@ const getRetailVolume = async (ticker) => { const response = await fetch(apiURL + '/retail-volume', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); diff --git a/src/lib/components/RevenueSegmentation.svelte b/src/lib/components/RevenueSegmentation.svelte index bf2f8dd8..309f3fb0 100644 --- a/src/lib/components/RevenueSegmentation.svelte +++ b/src/lib/components/RevenueSegmentation.svelte @@ -13,6 +13,8 @@ const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -156,7 +158,7 @@ const getRevenueSegmentation = async (ticker) => { const response = await fetch(apiURL + '/revenue-segmentation', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); diff --git a/src/lib/components/SECFilingsCard.svelte b/src/lib/components/SECFilingsCard.svelte index c904a13c..38be9d80 100644 --- a/src/lib/components/SECFilingsCard.svelte +++ b/src/lib/components/SECFilingsCard.svelte @@ -9,6 +9,8 @@ import { fade } from 'svelte/transition'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion?.subscribe(value => { if (usRegion?.includes(value)) { @@ -103,7 +105,7 @@ async function fetchData() { const response = await fetch(apiURL+'/get-sec-filings', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); diff --git a/src/lib/components/Searchbar.svelte b/src/lib/components/Searchbar.svelte index f2848ce5..6ef95327 100644 --- a/src/lib/components/Searchbar.svelte +++ b/src/lib/components/Searchbar.svelte @@ -8,6 +8,8 @@ const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { if (usRegion.includes(value)) { @@ -40,7 +42,7 @@ const response = await fetch(apiURL+'/searchbar-data', { method: 'GET', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json","X-API-KEY": apiKey }, }); diff --git a/src/lib/components/SellTrade.svelte b/src/lib/components/SellTrade.svelte index 3f7f073b..41b8a99d 100644 --- a/src/lib/components/SellTrade.svelte +++ b/src/lib/components/SellTrade.svelte @@ -101,7 +101,7 @@ async function handleSellOrder() const response = await fetch(fastifyURL+'/sell-stock', { method: 'POST', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json" }, body: JSON.stringify(postData) }); diff --git a/src/lib/components/SentimentAnalysis.svelte b/src/lib/components/SentimentAnalysis.svelte index b20b9edb..29c014df 100644 --- a/src/lib/components/SentimentAnalysis.svelte +++ b/src/lib/components/SentimentAnalysis.svelte @@ -8,6 +8,8 @@ const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -50,7 +52,7 @@ const getSentimentAnalysis = async (ticker) => { const response = await fetch(apiURL + '/sentiment-analysis', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); diff --git a/src/lib/components/ShareHolders.svelte b/src/lib/components/ShareHolders.svelte index 9dbd5841..f2670243 100644 --- a/src/lib/components/ShareHolders.svelte +++ b/src/lib/components/ShareHolders.svelte @@ -22,6 +22,8 @@ let putCallRatio; export let data; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -103,7 +105,7 @@ const getShareholders = async (ticker) => { const response = await fetch(apiURL + '/shareholders', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); diff --git a/src/lib/components/ShareStatistics.svelte b/src/lib/components/ShareStatistics.svelte index a24ae539..b659c6b4 100644 --- a/src/lib/components/ShareStatistics.svelte +++ b/src/lib/components/ShareStatistics.svelte @@ -13,6 +13,8 @@ const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -124,7 +126,7 @@ const getShareStatistics = async (ticker) => { const response = await fetch(apiURL + '/share-statistics', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); diff --git a/src/lib/components/StockSplits.svelte b/src/lib/components/StockSplits.svelte index 0801a7e0..3a45899e 100644 --- a/src/lib/components/StockSplits.svelte +++ b/src/lib/components/StockSplits.svelte @@ -22,8 +22,7 @@ } - - + diff --git a/src/lib/components/TagSearchbar.svelte b/src/lib/components/TagSearchbar.svelte index d5b1464a..3505f635 100644 --- a/src/lib/components/TagSearchbar.svelte +++ b/src/lib/components/TagSearchbar.svelte @@ -4,6 +4,8 @@ const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { if (usRegion.includes(value)) { @@ -36,7 +38,7 @@ const response = await fetch(apiURL+'/searchbar-data', { method: 'GET', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json","X-API-KEY": apiKey }, }); diff --git a/src/lib/components/TextArea.svelte b/src/lib/components/TextArea.svelte index d85d1cd1..b5a2f02c 100644 --- a/src/lib/components/TextArea.svelte +++ b/src/lib/components/TextArea.svelte @@ -77,4 +77,3 @@ function handleInput(event) { {/each} {/if} - diff --git a/src/lib/components/TextEditor.svelte b/src/lib/components/TextEditor.svelte index fc402112..044b611f 100644 --- a/src/lib/components/TextEditor.svelte +++ b/src/lib/components/TextEditor.svelte @@ -368,4 +368,3 @@ function handleImageInput(event) { - diff --git a/src/lib/components/TrendAnalysis.svelte b/src/lib/components/TrendAnalysis.svelte index 69369a64..d96aa7d4 100644 --- a/src/lib/components/TrendAnalysis.svelte +++ b/src/lib/components/TrendAnalysis.svelte @@ -10,6 +10,8 @@ const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -51,7 +53,7 @@ const getTrendAnalysis = async (ticker) => { const response = await fetch(apiURL + '/trend-analysis', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); diff --git a/src/lib/components/VaR.svelte b/src/lib/components/VaR.svelte index 2db76ed3..bd8b9393 100644 --- a/src/lib/components/VaR.svelte +++ b/src/lib/components/VaR.svelte @@ -14,6 +14,8 @@ const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -36,7 +38,7 @@ const response = await fetch(apiURL + '/value-at-risk', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); diff --git a/src/lib/components/WatchListCard.svelte b/src/lib/components/WatchListCard.svelte index bceec56a..e2752b45 100644 --- a/src/lib/components/WatchListCard.svelte +++ b/src/lib/components/WatchListCard.svelte @@ -10,6 +10,8 @@ const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { if (usRegion.includes(value)) { @@ -140,7 +142,7 @@ async function getWatchlistData() const response = await fetch(apiURL+'/get-watchlist', { method: 'POST', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json","X-API-KEY": apiKey }, body: JSON.stringify(postData) }); diff --git a/src/lib/tracker.ts b/src/lib/tracker.ts index 509f1af7..fb4dd1f7 100644 --- a/src/lib/tracker.ts +++ b/src/lib/tracker.ts @@ -26,7 +26,7 @@ export const trackPageVisit = async (path, userAgent) => { const response = await fetch(fastifyURL+'/mixpanel', { method: 'POST', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json" }, body: JSON.stringify(postData) }); @@ -47,7 +47,7 @@ export const trackPageDuration = async (path, userAgent, time) => { const response = await fetch(fastifyURL+'/mixpanel', { method: 'POST', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json" }, body: JSON.stringify(postData) }); @@ -69,7 +69,7 @@ export const trackPageError = async (path, userAgent, status, message) => { const response = await fetch(fastifyURL+'/mixpanel', { method: 'POST', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json" }, body: JSON.stringify(postData) }); @@ -88,7 +88,7 @@ export const trackAsset = async (symbol, assetType) => { const response = await fetch(fastifyURL+'/mixpanel', { method: 'POST', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json" }, body: JSON.stringify(postData) }); @@ -106,7 +106,7 @@ export const trackButtonClick = async (name) => { const response = await fetch(fastifyURL+'/mixpanel', { method: 'POST', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json" }, body: JSON.stringify(postData) }); diff --git a/src/lib/workers/notificationWorker.ts b/src/lib/workers/notificationWorker.ts index 630af43b..40bc2928 100644 --- a/src/lib/workers/notificationWorker.ts +++ b/src/lib/workers/notificationWorker.ts @@ -7,7 +7,7 @@ async function loadNotifications(fastifyURL:string, userId:string) { const response = await fetch(fastifyURL+'/get-notifications', { method: 'POST', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json","X-API-KEY": apiKey }, body: JSON.stringify(postData) }); diff --git a/src/lib/workers/twitchStatusWorker.ts b/src/lib/workers/twitchStatusWorker.ts index f3503af8..215031d2 100644 --- a/src/lib/workers/twitchStatusWorker.ts +++ b/src/lib/workers/twitchStatusWorker.ts @@ -3,7 +3,7 @@ async function loadTwitchStatus(fastifyURL:string,) { const response = await fetch(fastifyURL+'/get-twitch-status', { method: 'GET', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json","X-API-KEY": apiKey }, }); diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 57e3b448..b160f569 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -93,6 +93,8 @@ async function detectSWUpdate() { const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + let fastifyURL; userRegion.subscribe(value => { @@ -255,7 +257,7 @@ async function fallbackWorker() { const response = await fetch(fastifyURL+'/get-notifications', { method: 'POST', headers: { - 'Content-Type': 'application/json' + }, body: JSON.stringify(postData) }); diff --git a/src/routes/+page.ts b/src/routes/+page.ts index e26b425b..233345c3 100644 --- a/src/routes/+page.ts +++ b/src/routes/+page.ts @@ -24,7 +24,7 @@ export const load = async ({parent}) => { const response = await fetch('https://api.github.com/repos/stocknear/frontend', { method: 'GET', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json" }, }); @@ -47,7 +47,7 @@ export const load = async ({parent}) => { const response = await fetch('https://api.github.com/repos/stocknear/backend', { method: 'GET', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json" }, }); diff --git a/src/routes/analysts/+page.ts b/src/routes/analysts/+page.ts index e7edd20a..c6fad28c 100644 --- a/src/routes/analysts/+page.ts +++ b/src/routes/analysts/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -30,7 +32,7 @@ export const load = async ( { parent } ) => { const response = await fetch(apiURL + '/top-analysts', { method: 'GET', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, }); diff --git a/src/routes/analysts/[slug]/+page.ts b/src/routes/analysts/[slug]/+page.ts index dd475836..fc21c85a 100644 --- a/src/routes/analysts/[slug]/+page.ts +++ b/src/routes/analysts/[slug]/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -31,7 +33,7 @@ export const load = async ({params}) => { const response = await fetch(apiURL + '/analyst-stats', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); diff --git a/src/routes/analysts/top-stocks/+page.ts b/src/routes/analysts/top-stocks/+page.ts index a2504209..5fa4bf9b 100644 --- a/src/routes/analysts/top-stocks/+page.ts +++ b/src/routes/analysts/top-stocks/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -28,7 +30,7 @@ export const load = async ({parent}) => { const response = await fetch(apiURL + '/top-analysts-stocks', { method: 'GET', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, }); diff --git a/src/routes/blog/article/[slug]/+page.ts b/src/routes/blog/article/[slug]/+page.ts index b3527820..3f257cab 100644 --- a/src/routes/blog/article/[slug]/+page.ts +++ b/src/routes/blog/article/[slug]/+page.ts @@ -35,7 +35,7 @@ const getDiscordWidget = async () => { const response = await fetch('https://discord.com/api/guilds/1165618982133436436/widget.json', { method: 'GET', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, }); diff --git a/src/routes/community/post/[postId]/+page.svelte b/src/routes/community/post/[postId]/+page.svelte index 40d5dbca..2273ce9d 100644 --- a/src/routes/community/post/[postId]/+page.svelte +++ b/src/routes/community/post/[postId]/+page.svelte @@ -74,7 +74,7 @@ const response = await fetch(fastifyURL+'/upvote', { method: 'POST', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json" }, body: JSON.stringify(postData) }); // make a POST request to the server with the FormData object @@ -110,7 +110,7 @@ const response = await fetch(fastifyURL+'/downvote', { method: 'POST', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json" }, body: JSON.stringify(postData) }); // make a POST request to the server with the FormData object @@ -172,7 +172,7 @@ const response = await fetch(fastifyURL+'/delete-post', { method: 'POST', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json" }, body: JSON.stringify(postData) }); @@ -223,7 +223,7 @@ const response = await fetch(fastifyURL+'/get-all-comments', { method: 'POST', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json" }, body: JSON.stringify(postData), }); @@ -248,7 +248,7 @@ const response = await fetch(fastifyURL + '/get-moderators', { method: 'GET', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json" }, }); diff --git a/src/routes/community/post/[postId]/+page.ts b/src/routes/community/post/[postId]/+page.ts index 2e00fce2..300356ec 100644 --- a/src/routes/community/post/[postId]/+page.ts +++ b/src/routes/community/post/[postId]/+page.ts @@ -35,7 +35,7 @@ export const load = async ({ params }) => { const response = await fetch(fastifyURL + '/get-one-post', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json" }, body: JSON.stringify(postData), }); diff --git a/src/routes/community/profile/+page.svelte b/src/routes/community/profile/+page.svelte index 01cafb86..3d726a96 100644 --- a/src/routes/community/profile/+page.svelte +++ b/src/routes/community/profile/+page.svelte @@ -22,15 +22,13 @@ const usRegion = ['cle1','iad1','pdx1','sfo1']; - let apiURL; + let fastifyURL; userRegion.subscribe(value => { if (usRegion.includes(value)) { - apiURL = import.meta.env.VITE_USEAST_API_URL; fastifyURL = import.meta.env.VITE_USEAST_FASTIFY_URL; } else { - apiURL = import.meta.env.VITE_EU_API_URL; fastifyURL = import.meta.env.VITE_EU_FASTIFY_URL; } }); @@ -357,7 +355,7 @@ const getModerators = async () => { const response = await fetch(fastifyURL + '/get-moderators', { method: 'GET', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json" }, }); @@ -391,7 +389,7 @@ const getUserStats = async () => { const response = await fetch(fastifyURL + '/get-user-stats', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json" }, body: JSON.stringify(postData) }); @@ -458,7 +456,7 @@ async function getPost() { const response = await fetch(fastifyURL+'/get-post', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json" }, body: JSON.stringify(postData), }); diff --git a/src/routes/community/user/[userId]/+page.svelte b/src/routes/community/user/[userId]/+page.svelte index 526c7e32..7a02a695 100644 --- a/src/routes/community/user/[userId]/+page.svelte +++ b/src/routes/community/user/[userId]/+page.svelte @@ -17,15 +17,12 @@ const usRegion = ['cle1','iad1','pdx1','sfo1']; - let apiURL = import.meta.env.VITE_EU_API_URL; // Set a default API URL let fastifyURL = import.meta.env.VITE_EU_FASTIFY_URL; userRegion.subscribe(value => { if (usRegion.includes(value)) { - apiURL = import.meta.env.VITE_USEAST_API_URL; fastifyURL = import.meta.env.VITE_USEAST_FASTIFY_URL; } else { - apiURL = import.meta.env.VITE_EU_API_URL; fastifyURL = import.meta.env.VITE_EU_FASTIFY_URL; } }); @@ -62,7 +59,7 @@ const getUserData = async() => { const response = await fetch(fastifyURL+'/get-user-data', { method: 'POST', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json" }, body: JSON.stringify(postData) }); @@ -114,7 +111,7 @@ const getUserStats = async () => { const response = await fetch(fastifyURL + '/get-user-stats', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json" }, body: JSON.stringify(postData) }); @@ -142,7 +139,7 @@ const getModerators = async () => { const response = await fetch(fastifyURL + '/get-moderators', { method: 'GET', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json" }, }); @@ -176,7 +173,7 @@ async function getPost() { const response = await fetch(fastifyURL+'/get-post', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json" }, body: JSON.stringify(postData), }); diff --git a/src/routes/crypto/+page.ts b/src/routes/crypto/+page.ts index 6488d9ce..87849d00 100644 --- a/src/routes/crypto/+page.ts +++ b/src/routes/crypto/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -31,7 +33,7 @@ export const load = async () => { const response = await fetch(apiURL + '/all-crypto-tickers', { method: 'GET', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, }); diff --git a/src/routes/crypto/[tickerID]/+layout.server.ts b/src/routes/crypto/[tickerID]/+layout.server.ts index 48c977ac..28c8d14b 100644 --- a/src/routes/crypto/[tickerID]/+layout.server.ts +++ b/src/routes/crypto/[tickerID]/+layout.server.ts @@ -3,6 +3,7 @@ const usRegion = ['cle1','iad1','pdx1','sfo1']; let companyName; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; const fetchData = async (apiURL, endpoint, ticker) => { @@ -13,7 +14,7 @@ const fetchData = async (apiURL, endpoint, ticker) => { const response = await fetch(apiURL + endpoint, { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); @@ -34,7 +35,7 @@ const fetchWatchlist = async (fastifyURL, userId) => { const response = await fetch(fastifyURL+'/all-watchlists', { method: 'POST', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json" }, body: JSON.stringify(postData) }); @@ -51,7 +52,7 @@ async function fetchPortfolio(fastifyURL, userId) const response = await fetch(fastifyURL+'/get-portfolio-data', { method: 'POST', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json" }, body: JSON.stringify(postData) }); @@ -67,6 +68,7 @@ export const load = async ({ params, locals, setHeaders}) => { const userRegion = locals.region?.split("::")[0]; let apiURL; + let fastifyURL; if (usRegion?.includes(userRegion)) { diff --git a/src/routes/crypto/[tickerID]/+layout.svelte b/src/routes/crypto/[tickerID]/+layout.svelte index 364d0d55..d7914619 100644 --- a/src/routes/crypto/[tickerID]/+layout.svelte +++ b/src/routes/crypto/[tickerID]/+layout.svelte @@ -20,6 +20,8 @@ const usRegion = ['cle1','iad1','pdx1','sfo1']; let fastifyURL; let wsURL; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion?.subscribe(value => { if (usRegion?.includes(value)) { @@ -45,7 +47,7 @@ async function loadSearchData() { const response = await fetch(apiURL+'/searchbar-data', { method: 'GET', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json","X-API-KEY": apiKey }, }); @@ -177,7 +179,7 @@ async function toggleUserWatchlist(watchListId: string) { const response = await fetch(fastifyURL + '/update-watchlist', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json" }, body: JSON.stringify(postData), }); @@ -212,7 +214,7 @@ async function fetchPortfolio() const response = await fetch(fastifyURL+'/get-portfolio-data', { method: 'POST', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json" }, body: JSON.stringify(postData) }); diff --git a/src/routes/crypto/[tickerID]/+page.svelte b/src/routes/crypto/[tickerID]/+page.svelte index 5734c2ce..7ae63c2b 100644 --- a/src/routes/crypto/[tickerID]/+page.svelte +++ b/src/routes/crypto/[tickerID]/+page.svelte @@ -12,6 +12,8 @@ const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion?.subscribe(value => { if (usRegion?.includes(value)) { apiURL = import.meta.env.VITE_USEAST_API_URL; @@ -325,7 +327,7 @@ $: { const response = await fetch(apiURL+'/historical-price', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); diff --git a/src/routes/crypto/[tickerID]/congress-trading/+page.ts b/src/routes/crypto/[tickerID]/congress-trading/+page.ts index d1a76350..afca110a 100644 --- a/src/routes/crypto/[tickerID]/congress-trading/+page.ts +++ b/src/routes/crypto/[tickerID]/congress-trading/+page.ts @@ -3,6 +3,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -33,7 +35,7 @@ export const load = async ({ params }) => { const response = await fetch(apiURL + '/congress-trading-ticker', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); diff --git a/src/routes/crypto/[tickerID]/news/+page.ts b/src/routes/crypto/[tickerID]/news/+page.ts index c21219de..fe7050e8 100644 --- a/src/routes/crypto/[tickerID]/news/+page.ts +++ b/src/routes/crypto/[tickerID]/news/+page.ts @@ -4,6 +4,7 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL = import.meta.env.VITE_EU_API_URL; // Set a default API URL +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; userRegion.subscribe(value => { @@ -33,7 +34,7 @@ export const load = async ({ params }) => { const response = await fetch(apiURL + '/stock-news', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); diff --git a/src/routes/crypto/[tickerID]/stats/+page.ts b/src/routes/crypto/[tickerID]/stats/+page.ts index 595f0aa7..df51af88 100644 --- a/src/routes/crypto/[tickerID]/stats/+page.ts +++ b/src/routes/crypto/[tickerID]/stats/+page.ts @@ -2,6 +2,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { if (usRegion.includes(value)) { apiURL = import.meta.env.VITE_USEAST_API_URL; @@ -30,7 +32,7 @@ export const load = async ({ params }) => { const response = await fetch(apiURL + '/get-quant-stats', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); diff --git a/src/routes/crypto/[tickerID]/workers/historicalPriceWorker.ts b/src/routes/crypto/[tickerID]/workers/historicalPriceWorker.ts index 224c0754..54ad87e3 100644 --- a/src/routes/crypto/[tickerID]/workers/historicalPriceWorker.ts +++ b/src/routes/crypto/[tickerID]/workers/historicalPriceWorker.ts @@ -1,5 +1,6 @@ // lib/workers/test.ts +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; async function getOneDayPrice(ticker: string, apiURL:string) { @@ -10,7 +11,7 @@ async function getOneDayPrice(ticker: string, apiURL:string) { const response = await fetch(apiURL + '/one-day-price', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); @@ -41,7 +42,7 @@ async function getHistoricalPrice(ticker: string, apiURL:string) { const response = await fetch(apiURL + '/historical-price', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); diff --git a/src/routes/dark-pool-flow/+page.ts b/src/routes/dark-pool-flow/+page.ts index 16b9ccf9..eb8a8997 100644 --- a/src/routes/dark-pool-flow/+page.ts +++ b/src/routes/dark-pool-flow/+page.ts @@ -23,6 +23,8 @@ const checkMarketHour = async () => { const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -49,7 +51,7 @@ export const load = async ({parent}) => { const response = await fetch(apiURL + '/dark-pool-flow', { method: 'GET', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, }); diff --git a/src/routes/dividends-calendar/+page.ts b/src/routes/dividends-calendar/+page.ts index 50b0c1e4..edfd2be5 100644 --- a/src/routes/dividends-calendar/+page.ts +++ b/src/routes/dividends-calendar/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -31,7 +33,7 @@ export const load = async () => { const response = await fetch(apiURL + '/dividends-calendar', { method: 'GET', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, }); diff --git a/src/routes/earnings-calendar/+page.ts b/src/routes/earnings-calendar/+page.ts index d7abcfbe..e6c58347 100644 --- a/src/routes/earnings-calendar/+page.ts +++ b/src/routes/earnings-calendar/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -31,7 +33,7 @@ export const load = async () => { const response = await fetch(apiURL + '/earnings-calendar', { method: 'GET', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, }); diff --git a/src/routes/economic-calendar/+page.ts b/src/routes/economic-calendar/+page.ts index 1c88fb80..a57afbb2 100644 --- a/src/routes/economic-calendar/+page.ts +++ b/src/routes/economic-calendar/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -31,7 +33,7 @@ export const load = async () => { const response = await fetch(apiURL + '/economic-calendar', { method: 'GET', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, }); diff --git a/src/routes/etf/+page.ts b/src/routes/etf/+page.ts index aac7108a..8ece1d28 100644 --- a/src/routes/etf/+page.ts +++ b/src/routes/etf/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -31,7 +33,7 @@ export const load = async () => { const response = await fetch(apiURL + '/all-etf-tickers', { method: 'GET', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, }); diff --git a/src/routes/etf/[tickerID]/+layout.server.ts b/src/routes/etf/[tickerID]/+layout.server.ts index 9641d58f..af0ab095 100644 --- a/src/routes/etf/[tickerID]/+layout.server.ts +++ b/src/routes/etf/[tickerID]/+layout.server.ts @@ -2,6 +2,8 @@ const usRegion = ['cle1','iad1','pdx1','sfo1']; let companyName; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + function cleanString(input) { // Define a list of substrings to remove (case insensitive) @@ -37,7 +39,7 @@ const fetchData = async (apiURL, endpoint, ticker) => { const response = await fetch(apiURL + endpoint, { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); @@ -58,7 +60,7 @@ const fetchWatchlist = async (fastifyURL, userId) => { const response = await fetch(fastifyURL+'/all-watchlists', { method: 'POST', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json" }, body: JSON.stringify(postData) }); @@ -75,7 +77,7 @@ async function fetchPortfolio(fastifyURL, userId) const response = await fetch(fastifyURL+'/get-portfolio-data', { method: 'POST', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json" }, body: JSON.stringify(postData) }); @@ -90,6 +92,7 @@ export const load = async ({ params, locals, setHeaders}) => { const userRegion = locals.region?.split("::")[0]; let apiURL; + let fastifyURL; if (usRegion?.includes(userRegion)) { diff --git a/src/routes/etf/[tickerID]/+layout.svelte b/src/routes/etf/[tickerID]/+layout.svelte index b6863f47..03040e59 100644 --- a/src/routes/etf/[tickerID]/+layout.svelte +++ b/src/routes/etf/[tickerID]/+layout.svelte @@ -24,6 +24,8 @@ let fastifyURL; let wsURL; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion?.subscribe(value => { if (usRegion?.includes(value)) { @@ -49,7 +51,7 @@ async function loadSearchData() { const response = await fetch(apiURL+'/searchbar-data', { method: 'GET', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json","X-API-KEY": apiKey }, }); @@ -188,7 +190,7 @@ async function toggleUserWatchlist(watchListId: string) { const response = await fetch(fastifyURL + '/update-watchlist', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json" }, body: JSON.stringify(postData), }); @@ -222,7 +224,7 @@ async function fetchPortfolio() const response = await fetch(fastifyURL+'/get-portfolio-data', { method: 'POST', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json" }, body: JSON.stringify(postData) }); diff --git a/src/routes/etf/[tickerID]/+page.svelte b/src/routes/etf/[tickerID]/+page.svelte index e0fec27a..a51e92c1 100644 --- a/src/routes/etf/[tickerID]/+page.svelte +++ b/src/routes/etf/[tickerID]/+page.svelte @@ -15,6 +15,8 @@ const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion?.subscribe(value => { if (usRegion?.includes(value)) { apiURL = import.meta.env.VITE_USEAST_API_URL; @@ -340,7 +342,7 @@ async function historicalPrice(timePeriod:string) { const response = await fetch(apiURL+'/historical-price', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); @@ -439,7 +441,7 @@ async function initializePrice() { const response = await fetch(apiURL+'/pre-post-quote', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); diff --git a/src/routes/etf/[tickerID]/congress-trading/+page.ts b/src/routes/etf/[tickerID]/congress-trading/+page.ts index d1a76350..afca110a 100644 --- a/src/routes/etf/[tickerID]/congress-trading/+page.ts +++ b/src/routes/etf/[tickerID]/congress-trading/+page.ts @@ -3,6 +3,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -33,7 +35,7 @@ export const load = async ({ params }) => { const response = await fetch(apiURL + '/congress-trading-ticker', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); diff --git a/src/routes/etf/[tickerID]/dividends/+page.ts b/src/routes/etf/[tickerID]/dividends/+page.ts index a648e1fd..d3e6eeb5 100644 --- a/src/routes/etf/[tickerID]/dividends/+page.ts +++ b/src/routes/etf/[tickerID]/dividends/+page.ts @@ -4,6 +4,7 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL = import.meta.env.VITE_EU_API_URL; // Set a default API URL +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; userRegion.subscribe(value => { @@ -32,7 +33,7 @@ export const load = async ({ params }) => { const response = await fetch(apiURL + '/stock-dividend', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); diff --git a/src/routes/etf/[tickerID]/holdings/+page.ts b/src/routes/etf/[tickerID]/holdings/+page.ts index d2530e7c..b2fc00cc 100644 --- a/src/routes/etf/[tickerID]/holdings/+page.ts +++ b/src/routes/etf/[tickerID]/holdings/+page.ts @@ -3,6 +3,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -33,7 +35,7 @@ export const load = async ({ params }) => { const response = await fetch(apiURL + '/etf-holdings', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); diff --git a/src/routes/etf/[tickerID]/news/+page.ts b/src/routes/etf/[tickerID]/news/+page.ts index a993d62c..4dab539e 100644 --- a/src/routes/etf/[tickerID]/news/+page.ts +++ b/src/routes/etf/[tickerID]/news/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -33,7 +35,7 @@ export const load = async ({ params }) => { const response = await fetch(apiURL + '/stock-news', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); diff --git a/src/routes/etf/[tickerID]/options/+page.ts b/src/routes/etf/[tickerID]/options/+page.ts index e2511aa7..a0d3f221 100644 --- a/src/routes/etf/[tickerID]/options/+page.ts +++ b/src/routes/etf/[tickerID]/options/+page.ts @@ -3,6 +3,7 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL = import.meta.env.VITE_EU_API_URL; // Set a default API URL +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; userRegion.subscribe(value => { @@ -46,7 +47,7 @@ export const load = async ({ params }) => { const response = await fetch(apiURL + '/options-plot-ticker', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); @@ -107,7 +108,7 @@ export const load = async ({ params }) => { const response = await fetch(apiURL + '/options-flow-ticker', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); diff --git a/src/routes/etf/[tickerID]/stats/+page.ts b/src/routes/etf/[tickerID]/stats/+page.ts index 595f0aa7..df51af88 100644 --- a/src/routes/etf/[tickerID]/stats/+page.ts +++ b/src/routes/etf/[tickerID]/stats/+page.ts @@ -2,6 +2,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { if (usRegion.includes(value)) { apiURL = import.meta.env.VITE_USEAST_API_URL; @@ -30,7 +32,7 @@ export const load = async ({ params }) => { const response = await fetch(apiURL + '/get-quant-stats', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); diff --git a/src/routes/etf/etf-providers/+page.ts b/src/routes/etf/etf-providers/+page.ts index 6b42f9e2..1d5ff3b3 100644 --- a/src/routes/etf/etf-providers/+page.ts +++ b/src/routes/etf/etf-providers/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -29,7 +31,7 @@ export const load = async () => { const response = await fetch(apiURL + '/all-etf-providers', { method: 'GET', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, }); diff --git a/src/routes/etf/etf-providers/[slug]/+page.ts b/src/routes/etf/etf-providers/[slug]/+page.ts index 8fde6b66..7d51f2fd 100644 --- a/src/routes/etf/etf-providers/[slug]/+page.ts +++ b/src/routes/etf/etf-providers/[slug]/+page.ts @@ -3,7 +3,9 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; -let apiURL; +let apiURL +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; +; userRegion.subscribe(value => { @@ -36,7 +38,7 @@ export const load = async ({params}) => { const response = await fetch(apiURL + '/etf-provider', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData), }); diff --git a/src/routes/etf/new-launches/+page.ts b/src/routes/etf/new-launches/+page.ts index 4612c5cf..23b212ae 100644 --- a/src/routes/etf/new-launches/+page.ts +++ b/src/routes/etf/new-launches/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -31,7 +33,7 @@ export const load = async () => { const response = await fetch(apiURL + '/etf-new-launches', { method: 'GET', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, }); diff --git a/src/routes/fda-calendar/+page.ts b/src/routes/fda-calendar/+page.ts index 0e0777cd..edd36d17 100644 --- a/src/routes/fda-calendar/+page.ts +++ b/src/routes/fda-calendar/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -28,7 +30,7 @@ export const load = async ({parent}) => { const response = await fetch(apiURL + '/fda-calendar', { method: 'GET', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, }); diff --git a/src/routes/heatmaps/+page.ts b/src/routes/heatmaps/+page.ts index bf3ed930..b8525ee2 100644 --- a/src/routes/heatmaps/+page.ts +++ b/src/routes/heatmaps/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -31,7 +33,7 @@ export const load = async () => { const response = await fetch(apiURL + '/heatmaps', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData), }); @@ -58,7 +60,7 @@ export const load = async () => { const response = await fetch(apiURL + '/heatmaps', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData), }); @@ -85,7 +87,7 @@ export const load = async () => { const response = await fetch(apiURL + '/heatmaps', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData), }); diff --git a/src/routes/hedge-funds/[slug]/+page.ts b/src/routes/hedge-funds/[slug]/+page.ts index ec65ac05..24ddcc23 100644 --- a/src/routes/hedge-funds/[slug]/+page.ts +++ b/src/routes/hedge-funds/[slug]/+page.ts @@ -3,6 +3,8 @@ import { userRegion, displayCompanyName, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion?.subscribe(value => { if (usRegion?.includes(value)) { @@ -34,7 +36,7 @@ export const load = async ({ params }) => { const response = await fetch(apiURL + '/cik-data', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); diff --git a/src/routes/home/+page.svelte b/src/routes/home/+page.svelte index 5b762174..ee78877d 100644 --- a/src/routes/home/+page.svelte +++ b/src/routes/home/+page.svelte @@ -15,6 +15,8 @@ const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { if (usRegion.includes(value)) { @@ -111,7 +113,7 @@ async function loadSearchData() { const response = await fetch(apiURL+'/searchbar-data', { method: 'GET', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json","X-API-KEY": apiKey }, }); diff --git a/src/routes/home/+page.ts b/src/routes/home/+page.ts index b74c938a..e0f608f0 100644 --- a/src/routes/home/+page.ts +++ b/src/routes/home/+page.ts @@ -5,6 +5,8 @@ import { redirect } from '@sveltejs/kit'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -37,7 +39,7 @@ export const load = async ({ parent}) => { const response = await fetch(apiURL + '/market-movers', { method: 'GET', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, }); @@ -62,7 +64,7 @@ export const load = async ({ parent}) => { const response = await fetch(apiURL + '/rss-feed-wiim', { method: 'GET', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, }); diff --git a/src/routes/ipos/+page.ts b/src/routes/ipos/+page.ts index 545744e9..4be2a4b7 100644 --- a/src/routes/ipos/+page.ts +++ b/src/routes/ipos/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -32,7 +34,7 @@ export const load = async ({params}) => { const response = await fetch(apiURL + '/ipo-calendar', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData), }); diff --git a/src/routes/ipos/[slug]/+page.ts b/src/routes/ipos/[slug]/+page.ts index a8d95ef1..0131ca4a 100644 --- a/src/routes/ipos/[slug]/+page.ts +++ b/src/routes/ipos/[slug]/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -32,7 +34,7 @@ export const load = async ({params}) => { const response = await fetch(apiURL + '/ipo-calendar', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData), }); diff --git a/src/routes/leaderboard/+page.svelte b/src/routes/leaderboard/+page.svelte index 5844630a..b68dd384 100644 --- a/src/routes/leaderboard/+page.svelte +++ b/src/routes/leaderboard/+page.svelte @@ -169,7 +169,7 @@ async function getLeaderboard() { const response = await fetch(fastifyURL+'/leaderboard', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json" }, body: JSON.stringify(postData), }); diff --git a/src/routes/leaderboard/+page.ts b/src/routes/leaderboard/+page.ts index ceb3959b..2c097ba4 100644 --- a/src/routes/leaderboard/+page.ts +++ b/src/routes/leaderboard/+page.ts @@ -44,7 +44,7 @@ export const load = async ({ params }) => { const response = await fetch(fastifyURL+'/leaderboard', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json" }, body: JSON.stringify(postData), }); diff --git a/src/routes/list/amex-stocks/+page.ts b/src/routes/list/amex-stocks/+page.ts index 8d8319a8..176248a1 100644 --- a/src/routes/list/amex-stocks/+page.ts +++ b/src/routes/list/amex-stocks/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -31,7 +33,7 @@ export const load = async () => { const response = await fetch(apiURL + '/filter-stock-list', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData), }); diff --git a/src/routes/list/basic-materials-sector/+page.ts b/src/routes/list/basic-materials-sector/+page.ts index 0f848143..93e1b527 100644 --- a/src/routes/list/basic-materials-sector/+page.ts +++ b/src/routes/list/basic-materials-sector/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -31,7 +33,7 @@ export const load = async () => { const response = await fetch(apiURL + '/filter-stock-list', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData), }); diff --git a/src/routes/list/bitcoin-etfs/+page.ts b/src/routes/list/bitcoin-etfs/+page.ts index 8b549828..14cff5b5 100644 --- a/src/routes/list/bitcoin-etfs/+page.ts +++ b/src/routes/list/bitcoin-etfs/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -29,7 +31,7 @@ export const load = async () => { const response = await fetch(apiURL + '/etf-bitcoin-list', { method: 'GET', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, }); diff --git a/src/routes/list/canadian-stocks-us/+page.ts b/src/routes/list/canadian-stocks-us/+page.ts index 47400ca9..b4ec8fbd 100644 --- a/src/routes/list/canadian-stocks-us/+page.ts +++ b/src/routes/list/canadian-stocks-us/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -31,7 +33,7 @@ export const load = async () => { const response = await fetch(apiURL + '/filter-stock-list', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData), }); diff --git a/src/routes/list/chinese-stocks-us/+page.ts b/src/routes/list/chinese-stocks-us/+page.ts index d7b9ca66..1222c30e 100644 --- a/src/routes/list/chinese-stocks-us/+page.ts +++ b/src/routes/list/chinese-stocks-us/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -31,7 +33,7 @@ export const load = async () => { const response = await fetch(apiURL + '/filter-stock-list', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData), }); diff --git a/src/routes/list/communication-services-sector/+page.ts b/src/routes/list/communication-services-sector/+page.ts index 76f6020b..8bf11662 100644 --- a/src/routes/list/communication-services-sector/+page.ts +++ b/src/routes/list/communication-services-sector/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -31,7 +33,7 @@ export const load = async () => { const response = await fetch(apiURL + '/filter-stock-list', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData), }); diff --git a/src/routes/list/consumer-cyclical-sector/+page.ts b/src/routes/list/consumer-cyclical-sector/+page.ts index 0133ecf6..8222fc2a 100644 --- a/src/routes/list/consumer-cyclical-sector/+page.ts +++ b/src/routes/list/consumer-cyclical-sector/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -31,7 +33,7 @@ export const load = async () => { const response = await fetch(apiURL + '/filter-stock-list', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData), }); diff --git a/src/routes/list/consumer-defensive-sector/+page.ts b/src/routes/list/consumer-defensive-sector/+page.ts index 4cb0d3cb..f5419b06 100644 --- a/src/routes/list/consumer-defensive-sector/+page.ts +++ b/src/routes/list/consumer-defensive-sector/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -31,7 +33,7 @@ export const load = async () => { const response = await fetch(apiURL + '/filter-stock-list', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData), }); diff --git a/src/routes/list/delisted-stocks/+page.ts b/src/routes/list/delisted-stocks/+page.ts index e337bec9..725521af 100644 --- a/src/routes/list/delisted-stocks/+page.ts +++ b/src/routes/list/delisted-stocks/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -29,7 +31,7 @@ export const load = async () => { const response = await fetch(apiURL + '/delisted-companies', { method: 'GET', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, }); diff --git a/src/routes/list/dow-jones-stocks/+page.ts b/src/routes/list/dow-jones-stocks/+page.ts index 17bf6acd..a4c7d429 100644 --- a/src/routes/list/dow-jones-stocks/+page.ts +++ b/src/routes/list/dow-jones-stocks/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -30,7 +32,7 @@ export const load = async () => { const response = await fetch(apiURL + '/exchange-constituents', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData), }); diff --git a/src/routes/list/energy-sector/+page.ts b/src/routes/list/energy-sector/+page.ts index 0e2a5673..b6d959ec 100644 --- a/src/routes/list/energy-sector/+page.ts +++ b/src/routes/list/energy-sector/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -31,7 +33,7 @@ export const load = async () => { const response = await fetch(apiURL + '/filter-stock-list', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData), }); diff --git a/src/routes/list/financial-sector/+page.ts b/src/routes/list/financial-sector/+page.ts index 129b69bf..41abfcaa 100644 --- a/src/routes/list/financial-sector/+page.ts +++ b/src/routes/list/financial-sector/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -31,7 +33,7 @@ export const load = async () => { const response = await fetch(apiURL + '/filter-stock-list', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData), }); diff --git a/src/routes/list/german-stocks-us/+page.ts b/src/routes/list/german-stocks-us/+page.ts index 62d3fe30..5bd52a80 100644 --- a/src/routes/list/german-stocks-us/+page.ts +++ b/src/routes/list/german-stocks-us/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -31,7 +33,7 @@ export const load = async () => { const response = await fetch(apiURL + '/filter-stock-list', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData), }); diff --git a/src/routes/list/healthcare-sector/+page.ts b/src/routes/list/healthcare-sector/+page.ts index ec9884db..89cb1940 100644 --- a/src/routes/list/healthcare-sector/+page.ts +++ b/src/routes/list/healthcare-sector/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -31,7 +33,7 @@ export const load = async () => { const response = await fetch(apiURL + '/filter-stock-list', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData), }); diff --git a/src/routes/list/indian-stocks-us/+page.ts b/src/routes/list/indian-stocks-us/+page.ts index ad42d64a..8d4e8822 100644 --- a/src/routes/list/indian-stocks-us/+page.ts +++ b/src/routes/list/indian-stocks-us/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -31,7 +33,7 @@ export const load = async () => { const response = await fetch(apiURL + '/filter-stock-list', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData), }); diff --git a/src/routes/list/industrials-sector/+page.ts b/src/routes/list/industrials-sector/+page.ts index 6ef2d5a8..a9494272 100644 --- a/src/routes/list/industrials-sector/+page.ts +++ b/src/routes/list/industrials-sector/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -31,7 +33,7 @@ export const load = async () => { const response = await fetch(apiURL + '/filter-stock-list', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData), }); diff --git a/src/routes/list/israeli-stocks-us/+page.ts b/src/routes/list/israeli-stocks-us/+page.ts index 5bd17bd6..83011b52 100644 --- a/src/routes/list/israeli-stocks-us/+page.ts +++ b/src/routes/list/israeli-stocks-us/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -30,7 +32,7 @@ export const load = async () => { const response = await fetch(apiURL + '/filter-stock-list', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData), }); diff --git a/src/routes/list/japanese-stocks-us/+page.ts b/src/routes/list/japanese-stocks-us/+page.ts index 98c914cf..d46125c1 100644 --- a/src/routes/list/japanese-stocks-us/+page.ts +++ b/src/routes/list/japanese-stocks-us/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -30,7 +32,7 @@ export const load = async () => { const response = await fetch(apiURL + '/filter-stock-list', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData), }); diff --git a/src/routes/list/large-cap-stocks/+page.ts b/src/routes/list/large-cap-stocks/+page.ts index fba183f0..16cdb67d 100644 --- a/src/routes/list/large-cap-stocks/+page.ts +++ b/src/routes/list/large-cap-stocks/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -31,7 +33,7 @@ export const load = async () => { const response = await fetch(apiURL + '/filter-stock-list', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData), }); diff --git a/src/routes/list/magnificent-seven/+page.ts b/src/routes/list/magnificent-seven/+page.ts index d4d61bb7..35239c91 100644 --- a/src/routes/list/magnificent-seven/+page.ts +++ b/src/routes/list/magnificent-seven/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -30,7 +32,7 @@ export const load = async () => { const response = await fetch(apiURL + '/magnificent-seven', { method: 'GET', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, }); diff --git a/src/routes/list/mega-cap-stocks/+page.ts b/src/routes/list/mega-cap-stocks/+page.ts index f430bd92..546629e9 100644 --- a/src/routes/list/mega-cap-stocks/+page.ts +++ b/src/routes/list/mega-cap-stocks/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -31,7 +33,7 @@ export const load = async () => { const response = await fetch(apiURL + '/filter-stock-list', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData), }); diff --git a/src/routes/list/micro-cap-stocks/+page.ts b/src/routes/list/micro-cap-stocks/+page.ts index c20b3c4a..f248cd49 100644 --- a/src/routes/list/micro-cap-stocks/+page.ts +++ b/src/routes/list/micro-cap-stocks/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -31,7 +33,7 @@ export const load = async () => { const response = await fetch(apiURL + '/filter-stock-list', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData), }); diff --git a/src/routes/list/mid-cap-stocks/+page.ts b/src/routes/list/mid-cap-stocks/+page.ts index 5a7ef5a3..686df6bc 100644 --- a/src/routes/list/mid-cap-stocks/+page.ts +++ b/src/routes/list/mid-cap-stocks/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -31,7 +33,7 @@ export const load = async () => { const response = await fetch(apiURL + '/filter-stock-list', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData), }); diff --git a/src/routes/list/nano-cap-stocks/+page.ts b/src/routes/list/nano-cap-stocks/+page.ts index f2f1ce2f..0438c7c5 100644 --- a/src/routes/list/nano-cap-stocks/+page.ts +++ b/src/routes/list/nano-cap-stocks/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -31,7 +33,7 @@ export const load = async () => { const response = await fetch(apiURL + '/filter-stock-list', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData), }); diff --git a/src/routes/list/nasdaq-100-stocks/+page.ts b/src/routes/list/nasdaq-100-stocks/+page.ts index ae1af783..3f35f5de 100644 --- a/src/routes/list/nasdaq-100-stocks/+page.ts +++ b/src/routes/list/nasdaq-100-stocks/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -30,7 +32,7 @@ export const load = async () => { const response = await fetch(apiURL + '/exchange-constituents', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData), }); diff --git a/src/routes/list/nasdaq-stocks/+page.ts b/src/routes/list/nasdaq-stocks/+page.ts index 2e2486a4..573e064d 100644 --- a/src/routes/list/nasdaq-stocks/+page.ts +++ b/src/routes/list/nasdaq-stocks/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -31,7 +33,7 @@ export const load = async () => { const response = await fetch(apiURL + '/filter-stock-list', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData), }); diff --git a/src/routes/list/nyse-stocks/+page.ts b/src/routes/list/nyse-stocks/+page.ts index a109d2bc..b250e093 100644 --- a/src/routes/list/nyse-stocks/+page.ts +++ b/src/routes/list/nyse-stocks/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -31,7 +33,7 @@ export const load = async () => { const response = await fetch(apiURL + '/filter-stock-list', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData), }); diff --git a/src/routes/list/real-estate-sector/+page.ts b/src/routes/list/real-estate-sector/+page.ts index 3585c9b2..63c0d2e0 100644 --- a/src/routes/list/real-estate-sector/+page.ts +++ b/src/routes/list/real-estate-sector/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -30,7 +32,7 @@ export const load = async () => { const response = await fetch(apiURL + '/filter-stock-list', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData), }); diff --git a/src/routes/list/small-cap-stocks/+page.ts b/src/routes/list/small-cap-stocks/+page.ts index fe196d49..3ca10f09 100644 --- a/src/routes/list/small-cap-stocks/+page.ts +++ b/src/routes/list/small-cap-stocks/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -31,7 +33,7 @@ export const load = async () => { const response = await fetch(apiURL + '/filter-stock-list', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData), }); diff --git a/src/routes/list/sp-500-stocks/+page.ts b/src/routes/list/sp-500-stocks/+page.ts index f4a27061..9080e9f1 100644 --- a/src/routes/list/sp-500-stocks/+page.ts +++ b/src/routes/list/sp-500-stocks/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -30,7 +32,7 @@ export const load = async () => { const response = await fetch(apiURL + '/exchange-constituents', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData), }); diff --git a/src/routes/list/technology-sector/+page.ts b/src/routes/list/technology-sector/+page.ts index 54758369..c1ff210a 100644 --- a/src/routes/list/technology-sector/+page.ts +++ b/src/routes/list/technology-sector/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -31,7 +33,7 @@ export const load = async () => { const response = await fetch(apiURL + '/filter-stock-list', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData), }); diff --git a/src/routes/list/uk-stocks-us/+page.ts b/src/routes/list/uk-stocks-us/+page.ts index d6d7ec1d..96b959a1 100644 --- a/src/routes/list/uk-stocks-us/+page.ts +++ b/src/routes/list/uk-stocks-us/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -30,7 +32,7 @@ export const load = async () => { const response = await fetch(apiURL + '/filter-stock-list', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData), }); diff --git a/src/routes/list/utilities-sector/+page.ts b/src/routes/list/utilities-sector/+page.ts index e13fd4f5..1aa44a74 100644 --- a/src/routes/list/utilities-sector/+page.ts +++ b/src/routes/list/utilities-sector/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -31,7 +33,7 @@ export const load = async () => { const response = await fetch(apiURL + '/filter-stock-list', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData), }); diff --git a/src/routes/list/xetra-stocks/+page.ts b/src/routes/list/xetra-stocks/+page.ts index 626bfb88..39c0d29b 100644 --- a/src/routes/list/xetra-stocks/+page.ts +++ b/src/routes/list/xetra-stocks/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -31,7 +33,7 @@ export const load = async () => { const response = await fetch(apiURL + '/filter-stock-list', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData), }); diff --git a/src/routes/market-mover/+page.ts b/src/routes/market-mover/+page.ts index 20065908..b45713e0 100644 --- a/src/routes/market-mover/+page.ts +++ b/src/routes/market-mover/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -30,7 +32,7 @@ export const load = async () => { const response = await fetch(apiURL + '/market-movers', { method: 'GET', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, }); @@ -55,7 +57,7 @@ export const load = async () => { const response = await fetch(apiURL + '/mini-plots-index', { method: 'GET', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, }); diff --git a/src/routes/market-news/+page.ts b/src/routes/market-news/+page.ts index f89236e3..4afc77f8 100644 --- a/src/routes/market-news/+page.ts +++ b/src/routes/market-news/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -32,7 +34,7 @@ export const load = async () => { const response = await fetch(apiURL + '/market-news', { method: 'GET', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, }); diff --git a/src/routes/market-news/crypto/+page.ts b/src/routes/market-news/crypto/+page.ts index a450bf42..29c77dbd 100644 --- a/src/routes/market-news/crypto/+page.ts +++ b/src/routes/market-news/crypto/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -33,7 +35,7 @@ export const load = async () => { const response = await fetch(apiURL + '/crypto-news', { method: 'GET', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, }); diff --git a/src/routes/market-news/general/+page.ts b/src/routes/market-news/general/+page.ts index 1af1cb94..4ba0a84f 100644 --- a/src/routes/market-news/general/+page.ts +++ b/src/routes/market-news/general/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -33,7 +35,7 @@ export const load = async () => { const response = await fetch(apiURL + '/general-news', { method: 'GET', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, }); diff --git a/src/routes/most-retail-volume/+page.ts b/src/routes/most-retail-volume/+page.ts index a8da690f..68449679 100644 --- a/src/routes/most-retail-volume/+page.ts +++ b/src/routes/most-retail-volume/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -28,7 +30,7 @@ export const load = async ({parent}) => { const response = await fetch(apiURL + '/most-retail-volume', { method: 'GET', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, }); diff --git a/src/routes/most-shorted-stocks/+page.ts b/src/routes/most-shorted-stocks/+page.ts index 825a06e3..7f15d182 100644 --- a/src/routes/most-shorted-stocks/+page.ts +++ b/src/routes/most-shorted-stocks/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -28,7 +30,7 @@ export const load = async ({parent}) => { const response = await fetch(apiURL + '/most-shorted-stocks', { method: 'GET', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, }); diff --git a/src/routes/notifications/+page.server.ts b/src/routes/notifications/+page.server.ts index fe6dcae8..754b9e32 100644 --- a/src/routes/notifications/+page.server.ts +++ b/src/routes/notifications/+page.server.ts @@ -26,7 +26,7 @@ export const load = async ({ locals }) => { const response = await fetch(fastifyURL+'/get-notifications', { method: 'POST', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json" }, body: JSON.stringify(postData) }); diff --git a/src/routes/notifications/+page.svelte b/src/routes/notifications/+page.svelte index 020786c5..73fbcdc9 100644 --- a/src/routes/notifications/+page.svelte +++ b/src/routes/notifications/+page.svelte @@ -49,7 +49,7 @@ if (notificationIdList.length !== 0) await fetch(fastifyURL+'/update-notifications', { method: 'POST', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json","X-API-KEY": apiKey }, body: JSON.stringify(postData) diff --git a/src/routes/options-flow/+page.ts b/src/routes/options-flow/+page.ts index c2bdfb6d..9faf1d98 100644 --- a/src/routes/options-flow/+page.ts +++ b/src/routes/options-flow/+page.ts @@ -22,6 +22,8 @@ const checkMarketHour = async () => { const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -44,7 +46,7 @@ export const load = async () => { const response = await fetch(apiURL + '/options-flow-feed', { method: 'GET', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, }); const output = await response.json(); diff --git a/src/routes/options-zero-dte/+page.ts b/src/routes/options-zero-dte/+page.ts index 29722819..fe0260c8 100644 --- a/src/routes/options-zero-dte/+page.ts +++ b/src/routes/options-zero-dte/+page.ts @@ -22,6 +22,8 @@ const checkMarketHour = async () => { const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -44,7 +46,7 @@ export const load = async () => { const response = await fetch(apiURL + '/options-zero-dte', { method: 'GET', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, }); const output = await response.json(); diff --git a/src/routes/payment/+server.ts b/src/routes/payment/+server.ts index b9e50f61..f83dd9aa 100644 --- a/src/routes/payment/+server.ts +++ b/src/routes/payment/+server.ts @@ -23,7 +23,7 @@ export const POST = async ({ request, locals }) => { return new Response(JSON.stringify({ error: 'Invalid signature' }), { status: 403, headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json","X-API-KEY": apiKey } }); } @@ -72,7 +72,7 @@ export const POST = async ({ request, locals }) => { return new Response(JSON.stringify({ message: 'Payment data received successfully' }), { status: 200, headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json","X-API-KEY": apiKey } }); } catch (error) { @@ -80,7 +80,7 @@ export const POST = async ({ request, locals }) => { return new Response(JSON.stringify({ error: 'Internal server error' }), { status: 500, headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json","X-API-KEY": apiKey } }); } diff --git a/src/routes/politicians/+page.ts b/src/routes/politicians/+page.ts index d6b85c48..f84d7212 100644 --- a/src/routes/politicians/+page.ts +++ b/src/routes/politicians/+page.ts @@ -6,6 +6,8 @@ import { getPartyForPoliticians } from '$lib/utils'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { @@ -50,7 +52,7 @@ export const load = async () => { const response = await fetch(apiURL + '/all-politicians', { method: 'GET', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, }); diff --git a/src/routes/politicians/[slug]/+page.ts b/src/routes/politicians/[slug]/+page.ts index d4a2bbd3..6c8132f7 100644 --- a/src/routes/politicians/[slug]/+page.ts +++ b/src/routes/politicians/[slug]/+page.ts @@ -5,6 +5,8 @@ import { getPartyForPoliticians } from '$lib/utils'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + let images = {}; let politicianImage; let politicianDistrict; @@ -54,7 +56,7 @@ export const load = async ({params}) => { const response = await fetch(apiURL + '/politician-stats', { method: 'POST', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, body: JSON.stringify(postData) }); diff --git a/src/routes/politicians/flow-data/+page.server.ts b/src/routes/politicians/flow-data/+page.server.ts index d87d26eb..884594c3 100644 --- a/src/routes/politicians/flow-data/+page.server.ts +++ b/src/routes/politicians/flow-data/+page.server.ts @@ -6,6 +6,8 @@ export const load = async ({locals}) => { const userRegion = locals.region?.split("::")[0]; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + if (usRegion?.includes(userRegion)) { apiURL = import.meta.env.VITE_USEAST_API_URL; @@ -18,7 +20,7 @@ export const load = async ({locals}) => { const response = await fetch(apiURL + '/congress-rss-feed', { method: 'GET', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, }); diff --git a/src/routes/portfolio/+page.svelte b/src/routes/portfolio/+page.svelte index f90506dd..8f9e32e8 100644 --- a/src/routes/portfolio/+page.svelte +++ b/src/routes/portfolio/+page.svelte @@ -37,7 +37,7 @@ if (usRegion.includes(value)) { const response = await fetch(fastifyURL+'/get-portfolio', { method: 'POST', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json" }, body: JSON.stringify(postData) }); diff --git a/src/routes/price-alert/+page.svelte b/src/routes/price-alert/+page.svelte index fbbcf78a..4993b9a6 100644 --- a/src/routes/price-alert/+page.svelte +++ b/src/routes/price-alert/+page.svelte @@ -82,7 +82,7 @@ async function getPriceAlert() const response = await fetch(fastifyURL+'/get-price-alert', { method: 'POST', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json" }, body: JSON.stringify(postData) }); @@ -139,7 +139,7 @@ async function handleDelete() { const response = await fetch(fastifyURL+'/delete-price-alert', { method: 'POST', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json" }, body: JSON.stringify(postData) }); diff --git a/src/routes/price-alert/+page.ts b/src/routes/price-alert/+page.ts index 83fb9624..7f90044e 100644 --- a/src/routes/price-alert/+page.ts +++ b/src/routes/price-alert/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion?.subscribe(value => { @@ -31,7 +33,7 @@ export const load = async () => { const response = await fetch(apiURL + '/mini-plots-index', { method: 'GET', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, }); diff --git a/src/routes/register/+page.server.ts b/src/routes/register/+page.server.ts index b5e0ef6e..574f5397 100644 --- a/src/routes/register/+page.server.ts +++ b/src/routes/register/+page.server.ts @@ -8,7 +8,7 @@ const url = `https://disposable.debounce.io/?email=${encodeURIComponent(email)}` const response = await fetch(url, { method: 'GET', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json" }, }); const output = (await response.json())?.disposable ?? false; diff --git a/src/routes/sitemap.xml/+server.ts b/src/routes/sitemap.xml/+server.ts index bd9000fa..b558c124 100644 --- a/src/routes/sitemap.xml/+server.ts +++ b/src/routes/sitemap.xml/+server.ts @@ -2,6 +2,8 @@ import { userRegion } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + userRegion.subscribe(value => { if (usRegion.includes(value)) { apiURL = import.meta.env.VITE_USEAST_API_URL; @@ -123,7 +125,7 @@ export async function GET({locals}) { const rawData = await fetch(apiURL+'/searchbar-data', { method: 'GET', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json","X-API-KEY": apiKey }, }); diff --git a/src/routes/stock-screener/+page.svelte b/src/routes/stock-screener/+page.svelte index 4c6bbf40..ab86f522 100644 --- a/src/routes/stock-screener/+page.svelte +++ b/src/routes/stock-screener/+page.svelte @@ -12,6 +12,8 @@ const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + let fastifyURL; userRegion.subscribe(value => { @@ -38,7 +40,7 @@ async function getAllStrategies() const response = await fetch(fastifyURL+'/all-strategies', { method: 'POST', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json" }, body: JSON.stringify(postData) }); @@ -86,7 +88,7 @@ async function createStrategy(event) const response = await fetch(fastifyURL+'/create-strategy', { method: 'POST', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json" }, body: JSON.stringify(postData) }); @@ -144,7 +146,7 @@ onMount(async () => { const response = await fetch(fastifyURL+'/delete-strategy', { method: 'POST', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json" }, body: JSON.stringify(postData) }); diff --git a/src/routes/stock-screener/[strategyId]/+page.svelte b/src/routes/stock-screener/[strategyId]/+page.svelte index cbc7c3ca..48a9f8e1 100644 --- a/src/routes/stock-screener/[strategyId]/+page.svelte +++ b/src/routes/stock-screener/[strategyId]/+page.svelte @@ -501,7 +501,7 @@ async function handleSave(state:string) { const response = await fetch(fastifyURL+'/save-strategy', { method: 'POST', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json" }, body: JSON.stringify(postData) }); diff --git a/src/routes/stock-screener/[strategyId]/+page.ts b/src/routes/stock-screener/[strategyId]/+page.ts index 3fd07537..5cf3c436 100644 --- a/src/routes/stock-screener/[strategyId]/+page.ts +++ b/src/routes/stock-screener/[strategyId]/+page.ts @@ -4,6 +4,8 @@ import { userRegion, getCache, setCache } from '$lib/store'; const usRegion = ['cle1','iad1','pdx1','sfo1']; let apiURL; +let apiKey = import.meta.env.VITE_STOCKNEAR_API_KEY; + let fastifyURL; userRegion.subscribe(value => { @@ -34,7 +36,7 @@ export const load = async ({params}) => { const response = await fetch(fastifyURL+'/get-strategy', { method: 'POST', headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json" }, body: JSON.stringify(postData) }); @@ -59,7 +61,7 @@ export const load = async ({params}) => { const response = await fetch(apiURL + '/stock-screener-data', { method: 'GET', headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", "X-API-KEY": apiKey }, }); diff --git a/src/routes/stock-splits-calendar/+page.svelte b/src/routes/stock-splits-calendar/+page.svelte index d301efa6..60e0fb1f 100644 --- a/src/routes/stock-splits-calendar/+page.svelte +++ b/src/routes/stock-splits-calendar/+page.svelte @@ -348,7 +348,7 @@