Skip to content

Commit

Permalink
Change not found book
Browse files Browse the repository at this point in the history
  • Loading branch information
Henry committed Dec 22, 2017
1 parent 1eef125 commit 952ae35
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/BookDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,20 @@ class BookDetails extends React.Component {
}

componentDidMount() {
this.setState({ book: { title: "Not found" }})
const currentRoute = window.location.href;
const bookID = currentRoute.slice(currentRoute.search("/book/")+6, -1);
BooksAPI.get(bookID).then((book) => { this.setState({ book }) })
}

render() {
const { book } = this.state

const found = book => {
const { authors, title, categories, description, publishedDate, previewLink } = book;
return (
const {
authors, title, categories, description, publishedDate, previewLink
} = book;
return (
<div className="bookshelf">
<div className="search-books-bar book-details-bar">
<Link to="/" className="close-search book-details-home">Home</Link>
Expand All @@ -51,7 +54,17 @@ class BookDetails extends React.Component {
)
}

const notFound = <div>Book not found</div>;
const notFound = <div className="bookshelf">
<div className="search-books-bar book-details-bar">
<Link to="/" className="close-search book-details-home">Home</Link>
<div className="list-books-title">
<h1>Book not found</h1>
</div>
</div>
<div className="search-books-results">
Book not found
</div>
</div>;

return (
<div className="fadeIn">
Expand Down

0 comments on commit 952ae35

Please sign in to comment.