Last active
July 16, 2020 12:24
-
-
Save dgorodnichy/07d040b1d89c863fa6991cf38c089fbb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Api | |
class LikesController < ApplicationController | |
def update | |
@user = User.find(params["user_id"]) | |
@post = Post.find(params["post_id"]) | |
result = ToggleLikeActionScript.new(@user, @post).perform | |
if result.success? | |
render json: { isLiked: result.value } | |
else | |
render json: { errors: result.errors } | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment