From 6dca84899f9f044d0e48499ffc06447fdd642db4 Mon Sep 17 00:00:00 2001 From: Ken Jannette Date: Sat, 21 Apr 2018 14:39:34 -0400 Subject: [PATCH] added logic to compare search results to books on shelves in order to set correct shelf for search result books --- src/SearchPage.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/SearchPage.js b/src/SearchPage.js index 43d2079..d8484c6 100644 --- a/src/SearchPage.js +++ b/src/SearchPage.js @@ -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 }); }) }