update endpoint
This commit is contained in:
parent
50914f778f
commit
ba35596a6b
@ -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));
|
|
||||||
};
|
|
||||||
@ -31,7 +31,6 @@ export const POST = (async ({ request, locals }) => {
|
|||||||
serialize({
|
serialize({
|
||||||
user: user?.id,
|
user: user?.id,
|
||||||
ticker: JSON.stringify([ticker]),
|
ticker: JSON.stringify([ticker]),
|
||||||
ruleOfList: JSON.stringify([]),
|
|
||||||
title: "Favorites",
|
title: "Favorites",
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|||||||
@ -383,6 +383,9 @@ $: {
|
|||||||
{#each allList as item}
|
{#each allList as item}
|
||||||
<DropdownMenu.Item on:click={() => changeWatchList(item)} class="{item?.id === displayWatchList?.id ? 'bg-[#27272A]' : ''} cursor-pointer sm:hover:bg-[#27272A]">
|
<DropdownMenu.Item on:click={() => changeWatchList(item)} class="{item?.id === displayWatchList?.id ? 'bg-[#27272A]' : ''} cursor-pointer sm:hover:bg-[#27272A]">
|
||||||
{item?.title} ({item?.ticker?.length})
|
{item?.title} ({item?.ticker?.length})
|
||||||
|
<label for="deleteWatchlist" class="ml-auto inline-block cursor-pointer text-white sm:hover:text-red-500" on:click|stopPropagation={(e) => e?.preventDefault()}>
|
||||||
|
<svg class="size-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" style="max-width:40px"><path stroke-linecap="round" stroke-linejoin="round" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"></path></svg>
|
||||||
|
</label>
|
||||||
</DropdownMenu.Item>
|
</DropdownMenu.Item>
|
||||||
{/each}
|
{/each}
|
||||||
</DropdownMenu.Group>
|
</DropdownMenu.Group>
|
||||||
@ -391,7 +394,7 @@ $: {
|
|||||||
|
|
||||||
<label for="deleteWatchlist" class="border text-sm border-gray-600 ml-3 cursor-pointer inline-flex items-center justify-center space-x-1 whitespace-nowrap rounded-md py-2 pl-3 pr-4 font-semibold text-white shadow-sm bg-[#09090B] sm:hover:bg-[#09090B]/60 ease-out sm:hover:text-red-500">
|
<label for="deleteWatchlist" class="border text-sm border-gray-600 ml-3 cursor-pointer inline-flex items-center justify-center space-x-1 whitespace-nowrap rounded-md py-2 pl-3 pr-4 font-semibold text-white shadow-sm bg-[#09090B] sm:hover:bg-[#09090B]/60 ease-out sm:hover:text-red-500">
|
||||||
<svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path fill="currentColor" d="M360 184h-8c4.4 0 8-3.6 8-8zh304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32M731.3 840H292.7l-24.2-512h487z"/></svg>
|
<svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path fill="currentColor" d="M360 184h-8c4.4 0 8-3.6 8-8zh304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32M731.3 840H292.7l-24.2-512h487z"/></svg>
|
||||||
<div>Delete</div>
|
<div>Edit</div>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<DropdownMenu.Root >
|
<DropdownMenu.Root >
|
||||||
@ -482,12 +485,12 @@ $: {
|
|||||||
<!-- head -->
|
<!-- head -->
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="border-b-[#09090B]">
|
<tr class="border-b-[#09090B]">
|
||||||
<th class="text-white font-semibold text-sm">Symbol</th>
|
<th class="text-white font-semibold text-sm sm:text-[1rem]">Symbol</th>
|
||||||
<th class="text-white font-semibold text-sm">Company</th>
|
<th class="text-white font-semibold text-sm sm:text-[1rem]">Company</th>
|
||||||
|
|
||||||
{#each ruleOfList as item}
|
{#each ruleOfList as item}
|
||||||
{#if isChecked(item?.name)}
|
{#if isChecked(item?.name)}
|
||||||
<th class="text-white font-semibold text-end text-sm">{item?.name}</th>
|
<th class="text-white font-semibold text-end text-sm sm:text-[1rem]">{item?.name}</th>
|
||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
</tr>
|
</tr>
|
||||||
@ -659,7 +662,6 @@ $: {
|
|||||||
|
|
||||||
<input class="hidden" name='user' value={data?.user?.id} />
|
<input class="hidden" name='user' value={data?.user?.id} />
|
||||||
<input class="hidden" name='ticker' value={JSON.stringify([])} />
|
<input class="hidden" name='ticker' value={JSON.stringify([])} />
|
||||||
<input class="hidden" name='ruleOfList' value={JSON.stringify([])} />
|
|
||||||
|
|
||||||
<button type="submit" class="mt-10 btn bg-purple-600 sm:hover:bg-purple-700 btn-md w-full rounded-lg m-auto text-white font-bold text-md">
|
<button type="submit" class="mt-10 btn bg-purple-600 sm:hover:bg-purple-700 btn-md w-full rounded-lg m-auto text-white font-bold text-md">
|
||||||
Create List
|
Create List
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user