🐛 Fixed error when search too short

This commit is contained in:
Florian Sylvain
2022-01-07 18:07:45 +01:00
parent 8d79696ce0
commit a2d42aaa61
+7 -1
View File
@@ -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.')