make the search function pure instead of calling renderTable
This commit is contained in:
parent
913ec3d05e
commit
4a02014bef
@ -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));
|
||||||
|
});
|
||||||
|
renderTable(books);
|
||||||
});
|
});
|
||||||
return 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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user