Skip to content

Commit

Permalink
[FIX] bug lors de l'ajout
Browse files Browse the repository at this point in the history
  • Loading branch information
Amiralgaby committed Feb 21, 2021
1 parent cc439f0 commit 6f0e62b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion tp2/src/js/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function obtenirLesBoutonsArticle()
function realiserUnParagrapheErreur()
{
let newErreurText = document.createElement('p');
newErreurText.innerHTML = "[ERREUR] pas de duplication d'article";
newErreurText.innerHTML = "[ERREUR] duplication d'article : ajout échoué";
newErreurText.style.color = ROUGE;
newErreurText.classList.add('error');
return newErreurText;
Expand Down
12 changes: 4 additions & 8 deletions tp2/src/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ let inputSubmit = document.getElementsByName('addNewsBtn');
inputSubmit[0].onclick = function(e)
{
e.preventDefault();
let title = document.getElementsByName('titleToAdd')[0];
let desc = document.querySelector('textarea');
let art = new Article("",title,desc);
let input_title = document.getElementsByName('titleToAdd')[0];
let input_desc = document.querySelector('textarea');
let art = new Article(null,input_title.value,input_desc.value);
addArticle(art);
}

Expand All @@ -23,8 +23,4 @@ let articleList = [];
articles.forEach( element => articleList.push(new Article(element.id,element.title,element.desc)) );
logArray(articleList);

articleList.forEach(function(article)
{
logMessage(article.title+" "+article.desc);
addArticle(article);
});
articleList.forEach(article => addArticle(article));

0 comments on commit 6f0e62b

Please sign in to comment.