aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/invoice/+page.server.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-03-03 16:08:52 -0800
committerAdam Soltys <[email protected]>2026-03-03 16:08:52 -0800
commit8551df92b96ff69f3cda50184cb714ba30f3803d (patch)
treeb53b414d20d40d9bb9ab33764caa113c5996a262 /src/routes/(app)/invoice/+page.server.ts
parent14fff3ba852b1d696f61a0da25aaf0e04ccd4158 (diff)
downloadcoinos-ui-8551df92b96ff69f3cda50184cb714ba30f3803d.tar.gz
coinos-ui-8551df92b96ff69f3cda50184cb714ba30f3803d.zip
get rid of /receive route
Diffstat (limited to 'src/routes/(app)/invoice/+page.server.ts')
-rw-r--r--src/routes/(app)/invoice/+page.server.ts12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/routes/(app)/invoice/+page.server.ts b/src/routes/(app)/invoice/+page.server.ts
index 92cfd18d..e3d8125f 100644
--- a/src/routes/(app)/invoice/+page.server.ts
+++ b/src/routes/(app)/invoice/+page.server.ts
@@ -3,16 +3,20 @@ import type { Invoice } from "$lib/types";
import { auth, post } from "$lib/utils";
import { error, redirect } from "@sveltejs/kit";
-export const load = async ({ cookies, parent }) => {
+export const load = async ({ cookies, parent, url }) => {
const aid = cookies.get("aid");
let { subject, user } = await parent();
const rates = await getRates();
- if (aid === user.id) redirect(307, `/${user.username}/receive`);
+
+ const type = url.searchParams.get("type") || undefined;
+ const address_type = url.searchParams.get("address_type") || undefined;
let invoice: Invoice = {
aid: aid || "",
rate: rates[user?.currency || subject?.currency],
+ ...(type && { type }),
+ ...(address_type && { address_type }),
};
if (!user) user = subject;
@@ -26,7 +30,9 @@ export const load = async ({ cookies, parent }) => {
const { id } = invoice;
+ const lnurl = url.searchParams.has("lnurl");
+
if (invoice.memoPrompt && !invoice.memo) {
redirect(307, `/invoice/${id}/memo`);
- } else redirect(307, `/invoice/${id}`);
+ } else redirect(307, `/invoice/${id}${lnurl ? "?lnurl=true" : ""}`);
};