From 10ec03fbdfa0c7394c58aa64094c94aeb1887d86 Mon Sep 17 00:00:00 2001 From: HombreLaser Date: Fri, 24 Feb 2023 23:26:00 -0600 Subject: Añade método show del controlador de usuarios MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/user_accounts_controller.rb | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/controllers/api/user_accounts_controller.rb b/app/controllers/api/user_accounts_controller.rb index 0825d33..b95105f 100644 --- a/app/controllers/api/user_accounts_controller.rb +++ b/app/controllers/api/user_accounts_controller.rb @@ -2,7 +2,13 @@ module Api # The UserAccounts controller. - class UserAccountsController < ApplicationController + class UserAccountsController < AuthenticatedController + skip_before_action :validate_jwt, only: [:create] + + def show + render json: serialized_user_account.serializable_hash + end + def create @user_account = UserAccount.new(permitted_params) @@ -14,12 +20,14 @@ module Api render json: Serializers::UserAccountSerializer.new(@user_account).serializable_hash end - # TODO: Must set authentication before defining the show method. - private def permitted_params params.require(:user_account).permit(:email, :first_name, :last_name, :password) end + + def serialized_user_account + @serialized_user_account ||= Serializers::UserAccountSerializer.new(current_user_account) + end end end -- cgit v1.2.3