From 3482d92ab631903b6127faf03ace8e04e7c38fe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Thu, 15 Feb 2024 01:10:28 +0100 Subject: [PATCH] catch 503 error --- client/homebrew/pages/archivePage/archivePage.jsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client/homebrew/pages/archivePage/archivePage.jsx b/client/homebrew/pages/archivePage/archivePage.jsx index 5bbee10b8..ebe24f7bc 100644 --- a/client/homebrew/pages/archivePage/archivePage.jsx +++ b/client/homebrew/pages/archivePage/archivePage.jsx @@ -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 (

Whenever you want, just start typing...

);} - if(error !== null) { + if(error === 'Error: Service Unavailable') { return (

I'm sorry, your request didn't work

@@ -116,7 +116,7 @@ const ArchivePage = createClass({ ); } - if(!brewCollection || brewCollection.length === 0) { + if(!brewCollection || brewCollection.length === 0 || error === 'Error: Not found') { return (

We haven't found brews meeting your request.