Class: Spree::GraphqlController

Inherits:
ApplicationController
  • Object
show all
Includes:
ActiveStorage::SetCurrent
Defined in:
app/controllers/spree/graphql_controller.rb

Instance Method Summary collapse

Instance Method Details

#executeObject



9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/spree/graphql_controller.rb', line 9

def execute
  render json: SolidusGraphqlApi::Schema.execute(
    params[:query],
    variables: ensure_hash(params[:variables]),
    context: SolidusGraphqlApi::Context.new(request: request).to_h,
    operation_name: params[:operationName]
  )
rescue StandardError => e
  raise e unless Rails.env.development?

  handle_error_in_development e
end