From 9b33690494500d57b5a76794436872ca27740cd9 Mon Sep 17 00:00:00 2001 From: ekzyis Date: Thu, 9 Nov 2023 04:21:28 +0100 Subject: [PATCH] Check if invoice not found --- vue/src/components/Invoice.vue | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/vue/src/components/Invoice.vue b/vue/src/components/Invoice.vue index 74245ea..37e1684 100644 --- a/vue/src/components/Invoice.vue +++ b/vue/src/components/Invoice.vue @@ -77,9 +77,9 @@ const poll = async () => { }, 1000) } } -const interval = setInterval(poll, INVOICE_POLL) -const invoice = ref(null) +let interval +const invoice = ref(undefined) const redirectTimeout = ref(3) const success = ref(null) const error = ref(null) @@ -96,6 +96,10 @@ const copy = () => { await (async () => { const url = window.origin + '/api/invoice/' + route.params.id const res = await fetch(url) + if (res.status === 404) { + error.value = 'invoice not found' + return + } const body = await res.json() if (body.Description) { const regexp = /\[market:(?[0-9]+)\]/ @@ -107,6 +111,7 @@ await (async () => { } } invoice.value = body + interval = setInterval(poll, INVOICE_POLL) })() @@ -125,6 +130,10 @@ figcaption { margin: 1em auto; } +a.label { + text-decoration: none; +} + div.grid { grid-template-columns: auto auto; }