diff --git a/materialious/src/routes/watch/[slug]/+page.svelte b/materialious/src/routes/watch/[slug]/+page.svelte index ae743aac..eecef4d5 100644 --- a/materialious/src/routes/watch/[slug]/+page.svelte +++ b/materialious/src/routes/watch/[slug]/+page.svelte @@ -9,7 +9,7 @@ postSubscribe, removePlaylistVideo } from '$lib/Api/index.js'; - import type { PlaylistPage, PlaylistPageVideo } from '$lib/Api/model.js'; + import type { Comments, PlaylistPage, PlaylistPageVideo } from '$lib/Api/model.js'; import Comment from '$lib/Comment.svelte'; import Player from '$lib/Player.svelte'; import Thumbnail from '$lib/Thumbnail.svelte'; @@ -33,7 +33,15 @@ export let data; - $: comments = data.comments; + let comments: Comments | null = null; + data.streamed.comments?.then((streamedComments) => { + comments = streamedComments; + }); + + let subscribed: boolean = false; + data.streamed.subscribed.then((isSubbed) => { + subscribed = isSubbed; + }); activePageStore.set(null); @@ -335,13 +343,13 @@ } async function toggleSubscribed() { - if (data.subscribed) { + if (subscribed) { await deleteUnsubscribe(data.video.authorId); } else { await postSubscribe(data.video.authorId); } - data.subscribed = !data.subscribed; + subscribed = !subscribed; } async function toggleTheatreMode() { @@ -391,10 +399,10 @@ {#if $authStore} - - - {/if} + {#await data.streamed.returnYTDislikes then returnYTDislikes} + {#if returnYTDislikes} + + {/if} + {/await}