MCPcopy Create free account
hub / github.com/R44VC0RP/opencode.cafe / handleLike

Function handleLike

components/comments/comment-card.tsx:80–96  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

78 }
79
80 const handleLike = async () => {
81 if (!isAuthenticated) return
82
83 // Optimistic update
84 const newLiked = !liked
85 setLiked(newLiked)
86 setLikeCount((prev) => (newLiked ? prev + 1 : prev - 1))
87
88 try {
89 await toggleLike({ commentId: comment._id })
90 } catch (err) {
91 // Revert on error
92 setLiked(!newLiked)
93 setLikeCount((prev) => (newLiked ? prev - 1 : prev + 1))
94 console.error("Failed to toggle like:", err)
95 }
96 }
97
98 if (comment.isDeleted) {
99 return (

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected