From 952ae35fb63b49f8a647c7ef07db9ec33b1834d5 Mon Sep 17 00:00:00 2001 From: Henry Date: Fri, 22 Dec 2017 23:03:00 +0000 Subject: [PATCH] Change not found book --- src/BookDetails.js | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/BookDetails.js b/src/BookDetails.js index dbc89b2..2b03c46 100644 --- a/src/BookDetails.js +++ b/src/BookDetails.js @@ -16,6 +16,7 @@ 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 }) }) @@ -23,10 +24,12 @@ class BookDetails extends React.Component { 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 (
Home @@ -51,7 +54,17 @@ class BookDetails extends React.Component { ) } - const notFound =
Book not found
; + const notFound =
+
+ Home +
+

Book not found

+
+
+
+ Book not found +
+
; return (