Empty search error displayed

This commit is contained in:
Kristy Fournier 2025-03-06 10:14:17 -05:00
parent dfc068abf3
commit 42e78ca977

View file

@ -95,7 +95,6 @@ function searchSongsEnter(e) {
async function searchSongs(searchTerm){ async function searchSongs(searchTerm){
let optionslist = [] let optionslist = []
document.getElementById("songlist").innerHTML = "" document.getElementById("songlist").innerHTML = ""
searchResults = await getFromServer({search:searchTerm},"search").then() searchResults = await getFromServer({search:searchTerm},"search").then()
//generate the visual song list //generate the visual song list
@ -124,7 +123,7 @@ async function searchSongs(searchTerm){
document.getElementById("songlist").appendChild(newItem); document.getElementById("songlist").appendChild(newItem);
} }
if (searchResults.length == 0) { if (JSON.stringify(searchResults)==JSON.stringify({})) {
//display error if no results //display error if no results
document.getElementById("songlist").innerHTML = "<h1>We might not have that one...</h1>"; document.getElementById("songlist").innerHTML = "<h1>We might not have that one...</h1>";
} }