This commit is contained in:
Ken Jannette
2018-04-23 10:43:12 -04:00
parent 1647623cbc
commit 579dcd7e55

View File

@@ -15,14 +15,18 @@ class SearchPage extends Component {
const books = this.props.books const books = this.props.books
if (query.length > 3) { if (query.length > 3) {
search(query).then((results) => { search(query).then((results) => {
for (var result of results) { if (results.error === undefined) {
for (var book of books) { for (var result of results) {
if (result.title === book.title) { for (var book of books) {
result.shelf = book.shelf if (result.title === book.title) {
result.shelf = book.shelf
}
} }
} }
this.setState({ results });
} else {
this.setState({results: []})
} }
this.setState({ results });
}) })
} }
}; };