diff --git a/test2.html b/test2.html index 471cd60..a6193d4 100644 --- a/test2.html +++ b/test2.html @@ -35,12 +35,22 @@ // 2. Fonction d'affichage du formulaire function editCategory() { - const categories = getRealCategories(); const container = document.getElementById('app-container'); + // 1. On vérifie si la variable existe vraiment + const rawData = typeof CATEGORY_LABELS !== 'undefined' ? CATEGORY_LABELS : {}; + + // 2. On transforme les valeurs en tableau + const categories = Object.values(rawData); + + // 3. Sécurité : si toujours vide, on alerte + if (categories.length === 0) { + alert("Erreur : CATEGORY_LABELS est vide ou non chargé."); + return; + } + container.innerHTML = `