RUBYCRITIC
class Api::V1::InternalController < ActionController::API - Api::V1::InternalController assumes too much for instance variable '@current_user'
- Api::V1::InternalController has no descriptive comment
include Pagy::Backend
include Api::Concerns::RequestExceptionHandler
before_action :authenticate_user
around_action :handle_with_exception, unless: :devise_controller?
def authenticate_user - Api::V1::InternalController#authenticate_user has approx 6 statements
header = request.headers['Authorization']
header = header.split(' ').last if header
begin
decoded = Users::JsonWebToken.decode_user(header)
@current_user = decoded[:ok]
@current_account = @current_user.account
rescue
render json: { errors: 'Unauthorized' }, status: :unauthorized
end
end
end