Override registration and session render methods

to remove wrapping data-element
This commit is contained in:
Thor77 2019-04-16 11:01:31 +02:00
parent f223c03686
commit 417b296d0e
3 changed files with 26 additions and 1 deletions

View File

@ -0,0 +1,13 @@
# frozen_string_literal: true
module Overrides
class RegistrationsController < DeviseTokenAuth::RegistrationsController
def render_create_success
render json: resource_data
end
def render_update_success
render json: resource_data
end
end
end

View File

@ -0,0 +1,9 @@
# frozen_string_literal: true
module Overrides
class SessionsController < DeviseTokenAuth::SessionsController
def render_create_success
render json: resource_data(resource_json: @resource.token_validation_response)
end
end
end

View File

@ -1,7 +1,10 @@
# frozen_string_literal: true
Rails.application.routes.draw do
mount_devise_token_auth_for 'User', at: 'users'
mount_devise_token_auth_for 'User', at: 'users', controllers: {
registrations: 'overrides/registrations',
sessions: 'overrides/sessions'
}
resources :matches, only: %i[show]
resources :teams, only: %i[show update]