Class: ActionDispatch::Routing::Mapper

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql_devise/rails/routes.rb

Instance Method Summary collapse

Instance Method Details

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



5
6
7
8
9
10
11
12
13
# File 'lib/graphql_devise/rails/routes.rb', line 5

def mount_graphql_devise_for(resource, options = {})
  clean_options = GraphqlDevise::ResourceLoader.new(resource, options, true).call(
    GraphqlDevise::Types::QueryType,
    GraphqlDevise::Types::MutationType
  )

  post clean_options.at, to: 'graphql_devise/graphql#auth'
  get  clean_options.at, to: 'graphql_devise/graphql#auth'
end