make the search function pure instead of calling renderTable
This commit is contained in:
@@ -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) {
|
||||||
|
Reference in New Issue
Block a user