avoid sending html redirect to api client
authorTom Clegg <tom@clinicalfuture.com>
Thu, 20 Jun 2013 15:16:46 +0000 (11:16 -0400)
committerTom Clegg <tom@clinicalfuture.com>
Thu, 20 Jun 2013 15:16:46 +0000 (11:16 -0400)
services/api/app/controllers/application_controller.rb

index 33f92ecbe45fb3821ac606b6c6261090e2a79456..0335bed9fb774a6414dfb43c6a976525477b193f 100644 (file)
@@ -209,12 +209,12 @@ class ApplicationController < ActionController::Base
   def login_required
     if !current_user
       respond_to do |format|
-        format.html  {
-          redirect_to '/auth/joshid'
-        }
         format.json {
           render :json => { errors: ['Not logged in'] }.to_json, status: 401
         }
+        format.html  {
+          redirect_to '/auth/joshid'
+        }
       end
     end
   end