fix: Alpine.js x-data broken by inner double quotes + API list response crash
- Extract JSON data to <script> tags instead of tojson_attr in x-data attributes
- Remove literal " from CSS selector in x-data (meta[name=csrf-token])
- Move Alpine.js defer script after extra_js block in base.html
- Add isinstance(resp, dict) guard before .get("error") in measure.py and maker.py
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -27,15 +27,15 @@ def recipe_list():
|
||||
|
||||
resp = api_client.get("/api/recipes", params=params)
|
||||
|
||||
if resp.get("error"):
|
||||
if isinstance(resp, dict) and resp.get("error"):
|
||||
flash(_("Errore nel caricamento delle ricette: %(error)s", error=resp.get("detail", "")), "error")
|
||||
recipes = []
|
||||
total = 0
|
||||
pages = 0
|
||||
else:
|
||||
recipes = resp.get("items", [])
|
||||
total = resp.get("total", 0)
|
||||
pages = resp.get("pages", 1)
|
||||
recipes = resp.get("items", []) if isinstance(resp, dict) else resp
|
||||
total = resp.get("total", 0) if isinstance(resp, dict) else len(recipes)
|
||||
pages = resp.get("pages", 1) if isinstance(resp, dict) else 1
|
||||
|
||||
return render_template(
|
||||
"maker/recipe_list.html",
|
||||
|
||||
Reference in New Issue
Block a user