step 5: add method to fetch votes

This commit is contained in:
Pascal Precht 2019-01-28 13:54:54 +01:00
parent c79154b9f2
commit 191d6ef5c5
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D

View File

@ -64,5 +64,10 @@ contract DReddit {
Post storage post = posts[_postId];
return (post.voters[msg.sender] == Ballot.NONE);
}
function getVote(uint _postId) public view returns (uint8) {
Post storage post = posts[_postId];
return uint8(post.voters[msg.sender]);
}
}