Merge pull request #26 from turniere/ticket/TURNIERE-100

Override registration and session render methods
This commit is contained in:
Thor77 2019-04-16 13:07:09 +02:00 committed by GitHub
commit 81985415b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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]