Sorry if this is too simple but I am new with php.
I need to change the number of votes from my react native app. I have an endpoint in function.php but I don't know how to use wpdiscuz to add a like or dislike to comment. My code looks like this:
add_action( 'rest_api_init', function () {
register_rest_route( 'wp/v2/comments_extended', '/change/(?P\d+)/(?P[a-z]+)', array(
'methods' => 'PUT',
'callback' => 'change_comment_votes'
) );
} );
function change_comment_votes( $request ) {
global $wpdb;
$commentId = $request['comment_id'];
$voteType = $request['vote_type'];
if (strcmp($voteType, 'like') === 0) {
}
else {
}
}
Or is there a different way to this if at all possible?

