mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-26 01:33:22 +00:00
Simplify complex method
This commit is contained in:
@@ -14,7 +14,6 @@ module Admin
|
||||
|
||||
def index
|
||||
# Fetch DFC catalog JSON for preview
|
||||
api = DfcRequest.new(spree_current_user)
|
||||
@catalog_url = params.require(:catalog_url).strip
|
||||
@catalog_json = api.call(@catalog_url)
|
||||
catalog = DfcCatalog.from_json(@catalog_json)
|
||||
@@ -67,6 +66,10 @@ module Admin
|
||||
|
||||
private
|
||||
|
||||
def api
|
||||
@api ||= DfcRequest.new(spree_current_user)
|
||||
end
|
||||
|
||||
def load_enterprise
|
||||
@enterprise = OpenFoodNetwork::Permissions.new(spree_current_user)
|
||||
.managed_product_enterprises.is_primary_producer
|
||||
|
||||
Reference in New Issue
Block a user