summaryrefslogtreecommitdiff
path: root/app/controllers/api/controller.rb
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2016-12-08 21:35:52 -0700
committermo khan <mo@mokhan.ca>2016-12-08 21:35:52 -0700
commit945855e8d5caf4e86063665d0960365bcc04788f (patch)
treeb117b53ff5dc3bcbd37588e6df3d8e3e2226c5a6 /app/controllers/api/controller.rb
parent2aa7a66c1576bf72445420f16339f74dcaf2f854 (diff)
extract method not_authenticated
Diffstat (limited to 'app/controllers/api/controller.rb')
-rw-r--r--app/controllers/api/controller.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/controllers/api/controller.rb b/app/controllers/api/controller.rb
index ef3a712..29a88d1 100644
--- a/app/controllers/api/controller.rb
+++ b/app/controllers/api/controller.rb
@@ -20,9 +20,13 @@ class Api::Controller < ActionController::Base
def authenticate!
return if current_user.present?
- return render json: { errors: ['Not Authenticated'] }, status: :unauthorized
+ not_authenticated!
rescue
- return render json: { errors: ['Not Authenticated'] }, status: :unauthorized
+ not_authenticated!
+ end
+
+ def not_authenticated!
+ render json: { errors: ['Not Authenticated'] }, status: :unauthorized
end
def auth_token