From 9e80b99abed648ab7772aaf347a159a1d2119e2e Mon Sep 17 00:00:00 2001 From: ben Date: Thu, 11 Dec 2025 11:11:57 +0100 Subject: [PATCH] correction erreur --- blog/js/ajouter_article.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/blog/js/ajouter_article.js b/blog/js/ajouter_article.js index 5a9223d..3224329 100644 --- a/blog/js/ajouter_article.js +++ b/blog/js/ajouter_article.js @@ -63,24 +63,24 @@ form.addEventListener('submit', function(e) { } } - // Simuler enregistrement (ancienne logique) + // Simuler enregistrement titreExistants.push(titre); - // ------------------------------- - // 📌 CRÉATION DE L'ARTICLE - // ------------------------------- + + // CRÉATION DE L'ARTICLE + const nouvelArticle = { id: Date.now(), titre: titleField.value.trim(), contenu: contenu, categorie: categorie, - published: published, // ← valeur TRUE/FALSE pour afficher le badge Facebook + published: published, // valeur TRUE/FALSE pour afficher le badge Facebook date: new Date().toISOString() }; - // -------------------------------- - // 📌 SAUVEGARDE DANS LOCALSTORAGE - // -------------------------------- + + // SAUVEGARDE DANS LOCALSTORAGE + let articles = JSON.parse(localStorage.getItem("articles")) || []; articles.push(nouvelArticle); localStorage.setItem("articles", JSON.stringify(articles));