mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-25 20:33:51 +00:00
error 500 catch and show
This commit is contained in:
@@ -41,7 +41,7 @@ const ArchivePage = createClass({
|
||||
this.setState({ searching: true, error: null });
|
||||
request
|
||||
.get(`/archive/${this.state.title}`)
|
||||
.then((res) => this.setState({ brewCollection: res.body.brews }, this.setState({ limit: res.body.message})))
|
||||
.then((res) => this.setState({ brewCollection: res.body.brews }, this.setState({ limit: res.body.message}, this.setState({ error: null}))))
|
||||
.catch((err) => this.setState({ error: err }))
|
||||
.finally(() => this.setState({ searching: false }));
|
||||
},
|
||||
@@ -62,6 +62,14 @@ const ArchivePage = createClass({
|
||||
renderFoundBrews() {
|
||||
const brews = this.state.brewCollection;
|
||||
console.log('brews: ',brews);
|
||||
if (this.state.error !== null) {
|
||||
return(
|
||||
<div className="foundBrews noBrews">
|
||||
<h2>I'm sorry, your request didn't work</h2>
|
||||
<p>Your search is not enough specific, too many brews meet this criteria for us to forward them.</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (!brews || brews.length === 0) {
|
||||
return(
|
||||
|
||||
@@ -11,9 +11,8 @@ body {
|
||||
height: 100%;
|
||||
background-color: #2C3E50;
|
||||
|
||||
h1,h2,h3 {
|
||||
h1,h2,h3,p {
|
||||
font-family: 'Open Sans';
|
||||
font-size: 30px;
|
||||
color: white;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user