From fd06610f287c5975b08317b131c43c478cdf6368 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sat, 7 Dec 2024 23:40:52 -0800 Subject: fix lnurl rate --- src/routes/(app)/ln/[lnurl]/+page.server.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/routes/(app)/ln') diff --git a/src/routes/(app)/ln/[lnurl]/+page.server.ts b/src/routes/(app)/ln/[lnurl]/+page.server.ts index 6f121db1..681137ad 100644 --- a/src/routes/(app)/ln/[lnurl]/+page.server.ts +++ b/src/routes/(app)/ln/[lnurl]/+page.server.ts @@ -5,21 +5,21 @@ import { error, fail, redirect } from "@sveltejs/kit"; export async function load({ params, parent }) { const { user } = await parent(); if (!user) redirect(307, "/register"); + const rates = await getRates(); - let data = { - rate: await getRates()[user.currency], - }; - + let data; try { const { lnurl } = params; data = await get(`/decode?text=${lnurl}`); - } catch (e: any) { - error(500, e.message); + } catch (e) { + const { message } = e as Error; + error(500, message); } if (!["payRequest", "withdrawRequest"].includes(data.tag)) error(500, "We only support LNURLp and LNURLw at this time"); + data.rate = rates[user.currency]; return data; } -- cgit v1.2.3