make the search function pure instead of calling renderTable

This commit is contained in:
David 2021-10-31 19:51:19 -04:00
parent 913ec3d05e
commit 4a02014bef

View File

@ -36,15 +36,11 @@
`.01.LZZ.jpg`;
}
});
return books;
})
.then((books) => {
document.getElementById("search").addEventListener("input", (e) => {
search(books, e.target.value);
renderTable(search(books, e.target.value));
});
renderTable(books);
});
return books;
})
.then(renderTable);
}
function search(books, searchBy) {
@ -63,7 +59,7 @@
}
);
}
renderTable(books);
return books;
}
function renderTable(books, sortField) {