aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-12-07 23:40:52 -0800
committerAdam Soltys <[email protected]>2024-12-07 23:40:52 -0800
commitfd06610f287c5975b08317b131c43c478cdf6368 (patch)
treec2d470efa38a2a65d5c5ee099a30fe1db3a29b6f /src
parent6ad016b4b5f3e1baf1d40b898b0e5c964df54590 (diff)
downloadcoinos-ui-fd06610f287c5975b08317b131c43c478cdf6368.tar.gz
coinos-ui-fd06610f287c5975b08317b131c43c478cdf6368.zip
fix lnurl rate
Diffstat (limited to 'src')
-rw-r--r--src/routes/(app)/+layout.server.ts9
-rw-r--r--src/routes/(app)/ln/[lnurl]/+page.server.ts12
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;
}