mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-07 03:22:38 +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 });
|
this.setState({ searching: true, error: null });
|
||||||
request
|
request
|
||||||
.get(`/archive/${this.state.title}`)
|
.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 }))
|
.catch((err) => this.setState({ error: err }))
|
||||||
.finally(() => this.setState({ searching: false }));
|
.finally(() => this.setState({ searching: false }));
|
||||||
},
|
},
|
||||||
@@ -62,6 +62,14 @@ const ArchivePage = createClass({
|
|||||||
renderFoundBrews() {
|
renderFoundBrews() {
|
||||||
const brews = this.state.brewCollection;
|
const brews = this.state.brewCollection;
|
||||||
console.log('brews: ',brews);
|
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) {
|
if (!brews || brews.length === 0) {
|
||||||
return(
|
return(
|
||||||
|
|||||||
@@ -11,9 +11,8 @@ body {
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
background-color: #2C3E50;
|
background-color: #2C3E50;
|
||||||
|
|
||||||
h1,h2,h3 {
|
h1,h2,h3,p {
|
||||||
font-family: 'Open Sans';
|
font-family: 'Open Sans';
|
||||||
font-size: 30px;
|
|
||||||
color: white;
|
color: white;
|
||||||
font-weight: 900;
|
font-weight: 900;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user