Skip to content

Commit 8334eb2

Browse files
committed
Use full path to mount resource route
1 parent f143d1f commit 8334eb2

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

lib/graphql_devise/rails/routes.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ class Mapper
33
def mount_graphql_devise_for(resource, opts = {})
44
custom_operations = opts[:operations] || {}
55

6-
path = opts.fetch(:at, '/')
6+
path = opts.fetch(:at, '/graphql_auth')
77
mapping_name = resource.underscore.tr('/', '_').to_sym
88

99
devise_for(
@@ -62,8 +62,8 @@ def mount_graphql_devise_for(resource, opts = {})
6262
Devise.mailer.helper(GraphqlDevise::MailerHelper)
6363

6464
devise_scope mapping_name do
65-
post "#{path}/graphql_auth", to: 'graphql_devise/graphql#auth'
66-
get "#{path}/graphql_auth", to: 'graphql_devise/graphql#auth'
65+
post path, to: 'graphql_devise/graphql#auth'
66+
get path, to: 'graphql_devise/graphql#auth'
6767
end
6868
end
6969
end

spec/dummy/config/routes.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
Rails.application.routes.draw do
2-
mount_graphql_devise_for 'User', at: 'api/v1', operations: {
2+
mount_graphql_devise_for 'User', at: '/api/v1/graphql_auth', operations: {
33
login: Mutations::Login,
44
sign_up: Mutations::SignUp
55
}
66

77
mount_graphql_devise_for(
88
'Admin',
99
authenticable_type: Types::CustomAdminType,
10-
at: 'api/v1/admin'
10+
at: '/api/v1/admin/graphql_auth'
1111
)
1212

1313
post '/api/v1/graphql', to: 'api/v1/graphql#graphql'

0 commit comments

Comments
 (0)