added logic to compare search results to books on shelves in order to set correct shelf for search result books
This commit is contained in:
@@ -12,8 +12,17 @@ class SearchPage extends Component {
|
||||
}
|
||||
|
||||
onSearch = (query) => {
|
||||
const books = this.props.books
|
||||
// console.log(books)
|
||||
if (query.length > 3) {
|
||||
search(query).then((results) => {
|
||||
for (result in results) {
|
||||
for (book in books) {
|
||||
if (result === book) {
|
||||
result.shelf = book.shelf
|
||||
}
|
||||
}
|
||||
}
|
||||
this.setState({ results });
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user