@@ -3,8 +3,8 @@ class Mapper
33 def mount_graphql_devise_for ( resource , opts = { } )
44 custom_operations = opts [ :operations ] || { }
55
6- path = opts . fetch ( :at , '/' )
7- mapping_name = resource . underscore . tr ( '/' , '_' )
6+ path = opts . fetch ( :at , '/graphql_auth ' )
7+ mapping_name = resource . underscore . tr ( '/' , '_' ) . to_sym
88
99 devise_for (
1010 resource . pluralize . underscore . tr ( '/' , '_' ) . to_sym ,
@@ -34,6 +34,7 @@ def mount_graphql_devise_for(resource, opts = {})
3434
3535 new_mutation
3636 end
37+ used_mutation . instance_variable_set ( :@resource_name , mapping_name )
3738
3839 GraphqlDevise ::Types ::MutationType . field ( "#{ mapping_name } _#{ action } " , mutation : used_mutation )
3940 end
@@ -53,15 +54,16 @@ def mount_graphql_devise_for(resource, opts = {})
5354
5455 new_query
5556 end
57+ used_query . instance_variable_set ( :@resource_name , mapping_name )
5658
5759 GraphqlDevise ::Types ::QueryType . field ( "#{ mapping_name } _#{ action } " , resolver : used_query )
5860 end
5961
6062 Devise . mailer . helper ( GraphqlDevise ::MailerHelper )
6163
62- devise_scope mapping_name . to_sym do
63- post " #{ path } /graphql_auth" , to : 'graphql_devise/graphql#auth'
64- get " #{ path } /graphql_auth" , to : 'graphql_devise/graphql#auth'
64+ devise_scope mapping_name do
65+ post path , to : 'graphql_devise/graphql#auth'
66+ get path , to : 'graphql_devise/graphql#auth'
6567 end
6668 end
6769 end
0 commit comments