work with current supplier backend
This commit is contained in:
@@ -8,3 +8,5 @@
|
|||||||
//
|
//
|
||||||
//= link supplier/foundation1/application.js
|
//= link supplier/foundation1/application.js
|
||||||
//= link supplier/foundation1/application.css
|
//= link supplier/foundation1/application.css
|
||||||
|
//
|
||||||
|
//= link supplier/app/application.js
|
||||||
|
|||||||
@@ -15,6 +15,15 @@ class ApplicationController < ActionController::Base
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def authenticate_employee!
|
||||||
|
if auth_token = params[:auth_token].presence
|
||||||
|
raise CanCan::AccessDenied unless employee = Employee.find_by_authentication_token(auth_token)
|
||||||
|
sign_in employee
|
||||||
|
else
|
||||||
|
super
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def allow_all_origins
|
def allow_all_origins
|
||||||
headers['Access-Control-Allow-Origin'] = '*'
|
headers['Access-Control-Allow-Origin'] = '*'
|
||||||
headers['Access-Control-Request-Method'] = '*'
|
headers['Access-Control-Request-Method'] = '*'
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ module Suppliers
|
|||||||
supplier = current_supplier || employee.suppliers.first
|
supplier = current_supplier || employee.suppliers.first
|
||||||
render json: {
|
render json: {
|
||||||
employee: JSONAPI::Serializer.serialize(employee, serializer: Suppliers::EmployeeSerializer),
|
employee: JSONAPI::Serializer.serialize(employee, serializer: Suppliers::EmployeeSerializer),
|
||||||
supplier: JSONAPI::Serializer.serialize(supplier, serializer: Suppliers::SupplierSerializer)
|
supplier: JSONAPI::Serializer.serialize(supplier, serializer: Suppliers::SupplierSerializer),
|
||||||
|
auth_token: employee.authentication_token,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,8 @@ module Qwaiter::SupplierBaseSerializer
|
|||||||
#alias_method :default_relationship_related_link, :relationship_related_link
|
#alias_method :default_relationship_related_link, :relationship_related_link
|
||||||
def relationship_related_link(attribute_name)
|
def relationship_related_link(attribute_name)
|
||||||
#super if related_link_for_attributes.include?(attribute_name)
|
#super if related_link_for_attributes.include?(attribute_name)
|
||||||
super
|
#super
|
||||||
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user