summaryrefslogtreecommitdiff
path: root/app/controllers/api/user_accounts_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/api/user_accounts_controller.rb')
-rw-r--r--app/controllers/api/user_accounts_controller.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/app/controllers/api/user_accounts_controller.rb b/app/controllers/api/user_accounts_controller.rb
index 3e03cf9..ca5d93b 100644
--- a/app/controllers/api/user_accounts_controller.rb
+++ b/app/controllers/api/user_accounts_controller.rb
@@ -10,15 +10,20 @@ module Api
end
def create
- @token = logic(permitted_params).call
+ @user_account = UserAccount.new(permitted_params)
- render json: @token, status: :ok and return if @token
+ render json: generate_token, status: :ok and return if @user_account.save
- render json: { errors: @logic.user_account.errors.full_messages }, status: :unprocessable_entity
+ render json: @user_account.errors.full_messages, status: :unprocessable_entity
end
private
+ def service_params
+ { email: @user_account.email,
+ role: @user_account.role }
+ end
+
def permitted_params
params.require(:user_account).permit(:role, :email, :first_name, :last_name, :password)
end