Move supplier full pull to being an api for the ember app and handle login and authorization a little bit better (should be even a lot better in the future)

This commit is contained in:
2020-03-03 17:11:57 -05:00
parent a7e771557d
commit 51748d5783
15 changed files with 55 additions and 22 deletions
@@ -1,6 +1,15 @@
class Suppliers::SessionsController < Devise::SessionsController
respond_to :json
def create
# taken from super except the respond_with
self.resource = warden.authenticate!(auth_options)
set_flash_message!(:notice, :signed_in)
sign_in(resource_name, resource)
yield resource if block_given?
render json: {employee_id: current_employee.id, auth_token: current_employee.authentication_token}
end
def destroy
session[:supplier_id] = nil
super