From e81396c0d2d7380aac3d28a9a2eec6c392eddf65 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Fri, 16 Feb 2024 22:56:45 -0800 Subject: refactor(hololive): single pinned fetch --- src/routes/hololive/+page.svelte | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/routes/hololive/+page.svelte b/src/routes/hololive/+page.svelte index 34783fdf..771bc808 100644 --- a/src/routes/hololive/+page.svelte +++ b/src/routes/hololive/+page.svelte @@ -37,23 +37,27 @@ } onMount(async () => { - schedulePromise = fetch(proxy('https://schedule.hololive.tv'), { - headers: { - Cookie: 'timezone=Asia/Tokyo' - } - }); + // schedulePromise = fetch(proxy('https://schedule.hololive.tv'), { + // headers: { + // Cookie: 'timezone=Asia/Tokyo' + // } + // }); getPinnedStreams(); }); const getPinnedStreams = () => { + let streams: string[] = []; + if ($identity.id !== -2) fetch(root(`/api/configuration?id=${$identity.id}`)).then((response) => { if (response.ok) response.json().then((data) => { - if (data && data.configuration) pinnedStreams = data.pinned_hololive_streams; + if (data && data.configuration) streams = data.pinned_hololive_streams; }); }); + + pinnedStreams = streams; }; const typeSchedule = (schedule: any) => schedule as ParseResult; -- cgit v1.2.3