diff --git a/app/controllers/space_api_controller.rb b/app/controllers/space_api_controller.rb index fca6c8e..ad16688 100644 --- a/app/controllers/space_api_controller.rb +++ b/app/controllers/space_api_controller.rb @@ -38,8 +38,19 @@ class SpaceApiController < ApplicationController else unless can? :access_doors_remotely, :door_access @output = "Sorry, your account isn't able to control doors remotely." + else + @output = "Ready to control doors. Send POST params to this URL as per the HTML form." end end + + # Render the form again (or result) + respond_to do |format| + format.html + format.json { + response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate" + render :json => @output + } + end end def access_post @@ -78,8 +89,17 @@ class SpaceApiController < ApplicationController end end - # Render the form again - render :access + # Render the form again (or result) + respond_to do |format| + format.html { + render :access + } + format.json { + response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate" + render :json => @output + } + end + end def check_auth(email,password)