From 9904ff2dd068068408d99bb7c52cfd26133fe11d Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Mon, 17 Jun 2024 21:04:21 +0200 Subject: [PATCH] bugfixing searchbar api --- src/lib/components/BullBearSay.svelte | 4 +-- src/routes/+page.svelte | 41 ++++++++++++++++++++++++--- 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/src/lib/components/BullBearSay.svelte b/src/lib/components/BullBearSay.svelte index 8f166d43..be3a8282 100644 --- a/src/lib/components/BullBearSay.svelte +++ b/src/lib/components/BullBearSay.svelte @@ -112,8 +112,8 @@ $: { {:else} -
- +
+ Unlock content with Pro Subscription
{/if} diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index a458ae3f..5d09bc25 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -10,9 +10,19 @@ //import michaelBurryProfile from '$lib/images/hedge_funds/0001649339.png'; import analystAvatar from '$lib/images/hedge_funds/default-avatar.png'; - import { screenWidth, numberOfUnreadNotification} from '$lib/store'; + import { userRegion, searchBarData, numberOfUnreadNotification} from '$lib/store'; + const usRegion = ['cle1','iad1','pdx1','sfo1']; + let apiURL; + + userRegion.subscribe(value => { + if (usRegion.includes(value)) { + apiURL = import.meta.env.VITE_USEAST_API_URL; + } else { + apiURL = import.meta.env.VITE_EU_API_URL; + } + }); export let data; @@ -89,6 +99,29 @@ onMount( async() => { }) +async function loadSearchData() { + + if($searchBarData?.length !== 0) + { + return + } + else { + + // make the GET request to the endpoint + const response = await fetch(apiURL+'/searchbar-data', { + method: 'GET', + headers: { + 'Content-Type': 'application/json' + }, + }); + + $searchBarData = await response.json(); + } + + + } + + @@ -173,7 +206,7 @@ onMount( async() => { Retail Investor Trader Tracker -
+
New @@ -207,8 +240,8 @@ onMount( async() => { -