diff --git a/app/controllers/admin/dfc_product_imports_controller.rb b/app/controllers/admin/dfc_product_imports_controller.rb index d5d2699808..30964fa313 100644 --- a/app/controllers/admin/dfc_product_imports_controller.rb +++ b/app/controllers/admin/dfc_product_imports_controller.rb @@ -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