diff options
| author | Adam Soltys <[email protected]> | 2024-12-07 23:40:52 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-12-07 23:40:52 -0800 |
| commit | a242aad71ecb6e042a09b72451aca674125c4a2c (patch) | |
| tree | c2d470efa38a2a65d5c5ee099a30fe1db3a29b6f /src | |
| parent | 7dc1358f9e87ad6fc9278f55250da8545f35ffab (diff) | |
| download | coinos-ui-a242aad71ecb6e042a09b72451aca674125c4a2c.tar.gz coinos-ui-a242aad71ecb6e042a09b72451aca674125c4a2c.zip | |
fix lnurl rate
Diffstat (limited to 'src')
| -rw-r--r-- | src/routes/(app)/+layout.server.ts | 9 | ||||
| -rw-r--r-- | src/routes/(app)/ln/[lnurl]/+page.server.ts | 12 |
2 files changed, 7 insertions, 14 deletions
diff --git a/src/routes/(app)/+layout.server.ts b/src/routes/(app)/+layout.server.ts index 9ecf6f0d..402c473d 100644 --- a/src/routes/(app)/+layout.server.ts +++ b/src/routes/(app)/+layout.server.ts @@ -5,7 +5,6 @@ export async function load({ cookies, request, url, params }) { const { pathname } = url; const { id, username } = params; const token = cookies.get("token"); - let rate; let user; if (token) { @@ -51,12 +50,6 @@ export async function load({ cookies, request, url, params }) { redirect(303, "/generate"); } - try { - rate = await get("/rate"); - } catch (e) { - console.log(e); - } - const theme = cookies.get("theme") || "light"; - return { user, token, rate, subject, theme }; + return { user, token, subject, theme }; } 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; } |
