Skip to content

Commit

Permalink
Delete redundant check for params
Browse files Browse the repository at this point in the history
  • Loading branch information
yaroslavrick committed Sep 6, 2023
1 parent 376c825 commit c90602d
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions app/controllers/api_wrapper_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

class ApiWrapperController < ApplicationController
def index
return unless parameters_set?

result = ApiWrapper::Index::Organizer.call(params_to_validate: index_params)

if result.success?
if result.success? && index_params.present?
@activity = result.activity
else
handle_error(result, :index)
Expand All @@ -33,10 +31,6 @@ def latest_activities_params
params.permit(:order, :sort)
end

def parameters_set?
index_params.values.any?(&:present?)
end

def handle_error(result, action)
flash.now[:alert] = result.errors
render action, status: result.semantic_status || 400
Expand Down

0 comments on commit c90602d

Please sign in to comment.