make root filter work with children's books
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
c30052bac7
commit
43c3a25758
@ -100,10 +100,11 @@ function apiResponseParsing(book) {
|
|||||||
|
|
||||||
function search(books, searchBy, includeChildrensBooks) {
|
function search(books, searchBy, includeChildrensBooks) {
|
||||||
searchBy = searchCleaner(searchBy);
|
searchBy = searchCleaner(searchBy);
|
||||||
if (searchBy !== "") {
|
books = books.filter(
|
||||||
books = books.filter(
|
({ title, authors, genre, publisher, series, year, childrens }) => {
|
||||||
({ title, authors, genre, publisher, series, year, childrens }) => {
|
var inSearch = true;
|
||||||
var inSearch = Object.values({
|
if (searchBy !== "") {
|
||||||
|
inSearch = Object.values({
|
||||||
title,
|
title,
|
||||||
authors: authors.join(" "),
|
authors: authors.join(" "),
|
||||||
genre,
|
genre,
|
||||||
@ -111,13 +112,13 @@ function search(books, searchBy, includeChildrensBooks) {
|
|||||||
series,
|
series,
|
||||||
year,
|
year,
|
||||||
}).find((field) => searchCleaner(field).indexOf(searchBy) !== -1);
|
}).find((field) => searchCleaner(field).indexOf(searchBy) !== -1);
|
||||||
if (!includeChildrensBooks) {
|
|
||||||
return inSearch && !childrens;
|
|
||||||
}
|
|
||||||
return inSearch;
|
|
||||||
}
|
}
|
||||||
);
|
if (!includeChildrensBooks) {
|
||||||
}
|
return inSearch && !childrens;
|
||||||
|
}
|
||||||
|
return inSearch;
|
||||||
|
}
|
||||||
|
);
|
||||||
return books;
|
return books;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user