From 21d7af74afd07c9539df7b2c5598af5b1268bca5 Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Thu, 28 Nov 2024 07:46:33 -0600 Subject: [PATCH] fetch() error handling --- static/index.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/static/index.html b/static/index.html index ebbdd2a..01e1c76 100644 --- a/static/index.html +++ b/static/index.html @@ -142,6 +142,10 @@ function set(short, long) { if (document.getElementById('short').value == oldShort && document.getElementById('long').value == oldLong) { await navigator.clipboard.writeText(`${window.location.origin}/${newShort}`); } + }).catch((err) => { + setTimeout(() => { + set(short, long); + }, 5000); }); const suggestParams = new URLSearchParams(); @@ -159,7 +163,7 @@ function set(short, long) { for (const short of (await resp.json()).shorts) { appendShortItem(short, long); } - }); + }).catch((err) => {}); } function setShortItem(short, icon) {