Added update API call to onResultSelect in app.js
This commit is contained in:
@@ -37,6 +37,10 @@ class BooksApp extends React.Component {
|
|||||||
books: [...this.state.books, newBook]
|
books: [...this.state.books, newBook]
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
const newBooks = this.state.books
|
||||||
|
newBooks.forEach((book) => {
|
||||||
|
update(book, book.shelf)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
onSelectChange = (e) => {
|
onSelectChange = (e) => {
|
||||||
|
|||||||
@@ -37,12 +37,12 @@ class SearchPage extends Component {
|
|||||||
</div>
|
</div>
|
||||||
<div className="search-books-results">
|
<div className="search-books-results">
|
||||||
<ol className="books-grid">
|
<ol className="books-grid">
|
||||||
{
|
{ this.state.results.length > 0 && (
|
||||||
this.state.results.map((result) => {
|
this.state.results.map((result) => {
|
||||||
return <li key={result.id}>
|
return <li key={result.id}>
|
||||||
<div className="book">
|
<div className="book">
|
||||||
<div className="book-top">
|
<div className="book-top">
|
||||||
<div className="book-cover" style={{ width: 128, height: 193, backgroundImage: `url("${ result.imageLinks.thumbnail }")` }}></div>
|
<div className="book-cover" style={{ width: 128, height: 193, backgroundImage: `url("${ result.imageLinks.thumbnail }")` }}></div>
|
||||||
<div className="book-shelf-changer">
|
<div className="book-shelf-changer">
|
||||||
<select name={result.id} onChange={onSelect}>
|
<select name={result.id} onChange={onSelect}>
|
||||||
<option value="none">Move to...</option>
|
<option value="none">Move to...</option>
|
||||||
@@ -57,7 +57,8 @@ class SearchPage extends Component {
|
|||||||
<div className="book-authors">{result.authors}</div>
|
<div className="book-authors">{result.authors}</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
})
|
})
|
||||||
|
)
|
||||||
}
|
}
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user