make the search function pure instead of calling renderTable
This commit is contained in:
@@ -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));
|
||||
});
|
||||
return books;
|
||||
})
|
||||
.then(renderTable);
|
||||
renderTable(books);
|
||||
});
|
||||
}
|
||||
|
||||
function search(books, searchBy) {
|
||||
@@ -63,7 +59,7 @@
|
||||
}
|
||||
);
|
||||
}
|
||||
renderTable(books);
|
||||
return books;
|
||||
}
|
||||
|
||||
function renderTable(books, sortField) {
|
||||
|
Reference in New Issue
Block a user