Module: GraphqlDevise::RouteMounter

Defined in:
lib/graphql_devise/route_mounter.rb

Instance Method Summary collapse

Instance Method Details

#mount_graphql_devise_for(resource, options = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/graphql_devise/route_mounter.rb', line 3

def mount_graphql_devise_for(resource, options = {})
  routing = auth_routing(resource, options.delete(:base_controller))

  clean_options = ResourceLoader.new(resource, options, true).call(
    Types::QueryType,
    Types::MutationType
  )

  require_introspection_auth(clean_options)

  post clean_options.at, to: routing
  get  clean_options.at, to: routing
end