From 579dcd7e558c94edfbb7d8af2ed45ed2c9c79204 Mon Sep 17 00:00:00 2001 From: Ken Jannette Date: Mon, 23 Apr 2018 10:43:12 -0400 Subject: [PATCH] No msg --- src/SearchPage.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/SearchPage.js b/src/SearchPage.js index 8a641d8..12f21ea 100644 --- a/src/SearchPage.js +++ b/src/SearchPage.js @@ -15,14 +15,18 @@ class SearchPage extends Component { const books = this.props.books if (query.length > 3) { search(query).then((results) => { - for (var result of results) { - for (var book of books) { - if (result.title === book.title) { - result.shelf = book.shelf + if (results.error === undefined) { + for (var result of results) { + for (var book of books) { + if (result.title === book.title) { + result.shelf = book.shelf + } } } + this.setState({ results }); + } else { + this.setState({results: []}) } - this.setState({ results }); }) } };