diff --git a/src/lib/components/lemmy/post/PostActions.svelte b/src/lib/components/lemmy/post/PostActions.svelte index d40f8139..0e996e24 100644 --- a/src/lib/components/lemmy/post/PostActions.svelte +++ b/src/lib/components/lemmy/post/PostActions.svelte @@ -81,6 +81,8 @@ post={post.post} bind:vote={post.my_vote} bind:score={post.counts.score} + bind:upvotes={post.counts.upvotes} + bind:downvotes={post.counts.downvotes} /> - - {#key score} - oldScore ? 4 : -4, duration: 200 }} - out:fly={{ y: score > oldScore ? -4 : 4, duration: 200 }} - style="grid-column: 1; grid-row: 1;" - > - - - {/key} - - - + + + {#key score} + oldScore ? 4 : -4, duration: 200 }} + out:fly={{ y: score > oldScore ? -4 : 4, duration: 200 }} + style="grid-column: 1; grid-row: 1;" + > + + + {/key} + + + +
+
+ + {upvotes} +
+
+ + {downvotes} +
+
+ diff --git a/src/lib/lemmy/contentview.ts b/src/lib/lemmy/contentview.ts index 0260a9c0..7e68d6f1 100644 --- a/src/lib/lemmy/contentview.ts +++ b/src/lib/lemmy/contentview.ts @@ -114,7 +114,7 @@ export async function vote( item: ContentView | Submission, vote: number, jwt: string -): Promise { +): Promise<{ upvotes: number; downvotes: number; score: number }> { if (isSubmission(item)) item = contentItem(item) if (item.type == 'post') { @@ -123,16 +123,16 @@ export async function vote( post_id: item.id, score: vote, }) - ).post_view.counts.score + ).post_view.counts } else if (item.type == 'comment') { return ( await getClient().likeComment({ comment_id: item.id, score: vote, }) - ).comment_view.counts.score + ).comment_view.counts } - return 0 + return { upvotes: 0, downvotes: 0, score: 0 } } export async function markAsRead(