diff --git a/ProjetProgWeb/app.js b/ProjetProgWeb/app.js index b2ed48b..033f232 100644 --- a/ProjetProgWeb/app.js +++ b/ProjetProgWeb/app.js @@ -72,7 +72,13 @@ function apiRequestThese(search, offset) { .then(data => { fetch(`api.php?q=count&search=${searchString}&option=${queryOption}&offset=0`) .then(response => response.json()) - .then(aCount => displayResults(data, aCount.data[0])) + .then(aCount => { + if (aCount.data) { + displayResults(data, aCount.data[0]) + } else { + displayResults(data, 0) + } + }) }) } else { alert('Veuillez attendre une seconde entre chaque recherche.')