Minor fixes
This commit is contained in:
@@ -71,8 +71,12 @@ export async function getSubscriptions(): Promise<Subscription[]> {
|
||||
}
|
||||
|
||||
export async function amSubscribed(authorId: string): Promise<boolean> {
|
||||
const subscriptions = (await getSubscriptions()).filter(sub => sub.authorId === authorId);
|
||||
return subscriptions.length === 1;
|
||||
try {
|
||||
const subscriptions = (await getSubscriptions()).filter(sub => sub.authorId === authorId);
|
||||
return subscriptions.length === 1;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export async function postSubscribe(authorId: string) {
|
||||
|
||||
@@ -9,11 +9,13 @@
|
||||
let replies: Comments;
|
||||
|
||||
async function loadReplies(continuation: string) {
|
||||
replies = await getComments(videoId, {
|
||||
continuation: continuation,
|
||||
sort_by: 'top',
|
||||
source: 'youtube'
|
||||
});
|
||||
try {
|
||||
replies = await getComments(videoId, {
|
||||
continuation: continuation,
|
||||
sort_by: 'top',
|
||||
source: 'youtube'
|
||||
});
|
||||
} catch {}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -56,7 +58,7 @@
|
||||
|
||||
{#if replies}
|
||||
{#each replies.comments as reply}
|
||||
<svelte:self comment={reply} />
|
||||
<svelte:self comment={reply} {videoId} />
|
||||
{/each}
|
||||
{/if}
|
||||
|
||||
|
||||
@@ -9,10 +9,17 @@ export async function load({ params }) {
|
||||
postHistory(video.videoId);
|
||||
}
|
||||
|
||||
let comments;
|
||||
try {
|
||||
comments = video.liveNow ? null : await getComments(params.slug, { sort_by: "top", source: "youtube" });
|
||||
} catch {
|
||||
comments = null;
|
||||
}
|
||||
|
||||
return {
|
||||
video: video,
|
||||
returnYTDislikes: get(returnYtDislikes) ? await getDislikes(params.slug) : null,
|
||||
comments: video.liveNow ? null : await getComments(params.slug, { sort_by: "top", source: "youtube" }),
|
||||
comments: comments,
|
||||
subscribed: await amSubscribed(video.authorId),
|
||||
content: phaseDescription(video.description)
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user