work off today
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
module Suppliers
|
||||
class ApplicationController < ::ApplicationController
|
||||
before_action :setup_employee_and_supplier!
|
||||
load_and_authorize_resource
|
||||
#load_and_authorize_resource
|
||||
if Rails.env.development?
|
||||
skip_before_action :setup_employee_and_supplier!, only: :employee_and_supplier
|
||||
end
|
||||
attr_reader :current_supplier
|
||||
helper_method :current_supplier
|
||||
layout 'supplier/app'
|
||||
@@ -16,6 +19,16 @@ module Suppliers
|
||||
end
|
||||
end
|
||||
|
||||
# GET
|
||||
def employee_and_supplier
|
||||
employee = current_employee || Employee.find_by_email('bterkuile@gmail.com')
|
||||
supplier = current_supplier || employee.suppliers.first
|
||||
render json: {
|
||||
employee: JSONAPI::Serializer.serialize(employee, serializer: Suppliers::EmployeeSerializer),
|
||||
supplier: JSONAPI::Serializer.serialize(supplier, serializer: Suppliers::SupplierSerializer)
|
||||
}
|
||||
end
|
||||
|
||||
def setup_employee_and_supplier!
|
||||
authenticate_employee!
|
||||
find_current_supplier!
|
||||
|
||||
Reference in New Issue
Block a user