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:
@@ -2,9 +2,10 @@
|
||||
{% block title %}{{ _('Gestione Ricette') }} — TieMeasureFlow{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<script>window.__recipeListData = {{ recipes|tojson }};</script>
|
||||
<div class="container mx-auto px-4 sm:px-6 lg:px-8 py-8 max-w-6xl"
|
||||
x-data="{
|
||||
recipes: {{ recipes|tojson_attr }},
|
||||
recipes: window.__recipeListData,
|
||||
search: '{{ search or '' }}',
|
||||
filter: 'all',
|
||||
deleteModal: false,
|
||||
@@ -34,7 +35,7 @@
|
||||
},
|
||||
|
||||
async deleteRecipe(id) {
|
||||
const csrfToken = document.querySelector('meta[name=\"csrf-token\"]')?.content;
|
||||
const csrfToken = document.querySelector('meta[name=csrf-token]')?.content;
|
||||
try {
|
||||
const resp = await fetch(`/maker/api/recipes/${id}`, {
|
||||
method: 'DELETE',
|
||||
|
||||
Reference in New Issue
Block a user