Finish the upvote/downvote implementation
This commit is contained in:
@@ -78,10 +78,15 @@ export const Post = observer(function Post({uri}: {uri: string}) {
|
||||
.toggleRepost()
|
||||
.catch(e => console.error('Failed to toggle repost', record, e))
|
||||
}
|
||||
const onPressToggleLike = () => {
|
||||
const onPressToggleUpvote = () => {
|
||||
item
|
||||
.toggleLike()
|
||||
.catch(e => console.error('Failed to toggle like', record, e))
|
||||
.toggleUpvote()
|
||||
.catch(e => console.error('Failed to toggle upvote', record, e))
|
||||
}
|
||||
const onPressToggleDownvote = () => {
|
||||
item
|
||||
.toggleDownvote()
|
||||
.catch(e => console.error('Failed to toggle downvote', record, e))
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -129,12 +134,15 @@ export const Post = observer(function Post({uri}: {uri: string}) {
|
||||
<PostCtrls
|
||||
replyCount={item.replyCount}
|
||||
repostCount={item.repostCount}
|
||||
likeCount={item.likeCount}
|
||||
upvoteCount={item.upvoteCount}
|
||||
downvoteCount={item.downvoteCount}
|
||||
isReposted={!!item.myState.repost}
|
||||
isLiked={!!item.myState.like}
|
||||
isUpvoted={!!item.myState.upvote}
|
||||
isDownvoted={!!item.myState.downvote}
|
||||
onPressReply={onPressReply}
|
||||
onPressToggleRepost={onPressToggleRepost}
|
||||
onPressToggleLike={onPressToggleLike}
|
||||
onPressToggleUpvote={onPressToggleUpvote}
|
||||
onPressToggleDownvote={onPressToggleDownvote}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
Reference in New Issue
Block a user