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
1 changed files with 4 additions and 8 deletions

View File

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