From ba35596a6becc85eab1bb452fd6aba00c2143ab1 Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Fri, 11 Oct 2024 15:46:32 +0200 Subject: [PATCH] update endpoint --- src/routes/api/indicator-data/+server.ts | 24 ---------------------- src/routes/api/update-watchlist/+server.ts | 1 - src/routes/watchlist/stocks/+page.svelte | 12 ++++++----- 3 files changed, 7 insertions(+), 30 deletions(-) delete mode 100644 src/routes/api/indicator-data/+server.ts diff --git a/src/routes/api/indicator-data/+server.ts b/src/routes/api/indicator-data/+server.ts deleted file mode 100644 index 952ce430..00000000 --- a/src/routes/api/indicator-data/+server.ts +++ /dev/null @@ -1,24 +0,0 @@ -import type { RequestHandler } from "./$types"; - -export const POST: RequestHandler = async ({ request, locals }) => { - const data = await request.json(); - const { apiURL, apiKey } = locals; - - const postData = { - ruleOfList: data?.ruleOfList, - tickerList: data?.tickerList, - }; - - const response = await fetch(apiURL + "/indicator-data", { - method: "POST", - headers: { - "Content-Type": "application/json", - "X-API-KEY": apiKey, - }, - body: JSON.stringify(postData), - }); - - const output = await response?.json(); - - return new Response(JSON.stringify(output)); -}; diff --git a/src/routes/api/update-watchlist/+server.ts b/src/routes/api/update-watchlist/+server.ts index d55b1246..24f125c8 100644 --- a/src/routes/api/update-watchlist/+server.ts +++ b/src/routes/api/update-watchlist/+server.ts @@ -31,7 +31,6 @@ export const POST = (async ({ request, locals }) => { serialize({ user: user?.id, ticker: JSON.stringify([ticker]), - ruleOfList: JSON.stringify([]), title: "Favorites", }) ); diff --git a/src/routes/watchlist/stocks/+page.svelte b/src/routes/watchlist/stocks/+page.svelte index 36343b65..df6833da 100644 --- a/src/routes/watchlist/stocks/+page.svelte +++ b/src/routes/watchlist/stocks/+page.svelte @@ -383,6 +383,9 @@ $: { {#each allList as item} changeWatchList(item)} class="{item?.id === displayWatchList?.id ? 'bg-[#27272A]' : ''} cursor-pointer sm:hover:bg-[#27272A]"> {item?.title} ({item?.ticker?.length}) + {/each} @@ -391,7 +394,7 @@ $: { @@ -482,12 +485,12 @@ $: { - Symbol - Company + Symbol + Company {#each ruleOfList as item} {#if isChecked(item?.name)} - {item?.name} + {item?.name} {/if} {/each} @@ -659,7 +662,6 @@ $: { -