Simplify complex method

This commit is contained in:
Maikel Linke
2025-03-06 09:31:15 +11:00
parent c60718feea
commit 2a81d26ef1

View File

@@ -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