aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/parse.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2025-07-19 17:59:56 -0700
committerAdam Soltys <[email protected]>2025-07-19 18:07:57 -0700
commitd87ecae6ee46af4790e1f57cd5d82a35ab29e646 (patch)
tree5fa86b7b8902315f625eca493861f3ad97de5a5c /src/lib/parse.ts
parentfea147df07046f240e77075e7c743959d85b1271 (diff)
downloadcoinos-ui-d87ecae6ee46af4790e1f57cd5d82a35ab29e646.tar.gz
coinos-ui-d87ecae6ee46af4790e1f57cd5d82a35ab29e646.zip
prompt for tip for auto pays
Diffstat (limited to 'src/lib/parse.ts')
-rw-r--r--src/lib/parse.ts11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/lib/parse.ts b/src/lib/parse.ts
index ba264be7..f6405e4a 100644
--- a/src/lib/parse.ts
+++ b/src/lib/parse.ts
@@ -57,10 +57,11 @@ export default async (s, host) => {
t = params.get("lightning");
}
+ let invoice;
if (t.toLowerCase().startsWith("ln")) {
try {
- const inv = await get(`/invoice/${t}`);
- if (inv.user.username === "mint") throw new Error("mint payment");
+ invoice = await get(`/invoice/${t}`);
+ if (invoice.user.username === "mint") throw new Error("mint payment");
} catch (e) {
if (t.toLowerCase().startsWith("lno")) {
const { offer_amount_msat: a } = await get(`/decode/${t}`);
@@ -115,11 +116,9 @@ export default async (s, host) => {
if (fund) redirect(307, `/send/fund/${t}`);
- // invoice
- let invoice;
try {
- invoice = await get(`/invoice/${t}`);
+ invoice ||= await get(`/invoice/${t}`);
} catch (e) {}
- if (invoice) redirect(307, `/send/invoice/${invoice.id}`);
+ if (invoice) redirect(307, `/invoice/${invoice.id}`);
};