We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4311b79 commit d249c51Copy full SHA for d249c51
src/components/Link.js
@@ -21,11 +21,11 @@ class Link extends Component {
21
</div>
22
)
23
}
24
-
+
25
_voteForLink = async () => {
26
const userId = localStorage.getItem(GC_USER_ID)
27
- const voterIds = this.props.link.votes.map(vote => vote.user.id)
28
- if (voterIds.includes(userId)) {
+ const userHasAlreadyVoted = this.props.link.votes.some(vote => vote.user.id === userId)
+ if (userHasAlreadyVoted) {
29
console.log(`User (${userId}) already voted for this link.`)
30
return
31
0 commit comments