From 2a57bab0a2033a32019e6ca1a50e486ef28db532 Mon Sep 17 00:00:00 2001 From: Expand Date: Thu, 30 Nov 2023 14:27:50 +1100 Subject: [PATCH] allow website to respond when ccash instance down --- index.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 470584e..1742a89 100644 --- a/index.js +++ b/index.js @@ -80,11 +80,16 @@ fastify.get("/", async function (req, res) { let errors = req.session.errors; req.session.errors = ""; console.log(`${api}/api/properties`); - let checkalive = await fetch(`${api}/api/properties`, { - headers: { - Accept: "application/json", - }, - }); + try{ + let checkalive = await fetch(`${api}/api/properties`, { + headers: { + Accept: "application/json", + }, + }); + } catch (e){ + console.log(e) + } + let alive = false if (checkalive.ok) { alive = true;