0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-29 02:32:37 +00:00

catch 503 error

This commit is contained in:
Víctor Losada Hernández
2024-02-15 01:10:28 +01:00
parent 74ac8f9ffa
commit 3482d92ab6

View File

@@ -60,6 +60,7 @@ const ArchivePage = createClass({
});
} catch (error) {
console.log(`LoadPage error: ${error}`);
this.setState({ error: {error} });
this.updateStateWithBrews([], 1, 1);
}
},
@@ -67,8 +68,7 @@ const ArchivePage = createClass({
updateUrl : function() {
const url = new URL(window.location.href);
const urlParams = new URLSearchParams(url.search);
// Set the title and page parameters
urlParams.set('title', this.state.title);
urlParams.set('page', this.state.page);
@@ -107,7 +107,7 @@ const ArchivePage = createClass({
if(title === '') {return (<div className='foundBrews noBrews'><h3>Whenever you want, just start typing...</h3></div>);}
if(error !== null) {
if(error === 'Error: Service Unavailable') {
return (
<div className='foundBrews noBrews'>
<div><h3>I'm sorry, your request didn't work</h3>
@@ -116,7 +116,7 @@ const ArchivePage = createClass({
);
}
if(!brewCollection || brewCollection.length === 0) {
if(!brewCollection || brewCollection.length === 0 || error === 'Error: Not found') {
return (
<div className='foundBrews noBrews'>
<h3>We haven't found brews meeting your request.</h3>