aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/pay
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes/(app)/pay')
-rw-r--r--src/routes/(app)/pay/[username]/[...amount]/+page.server.ts2
-rw-r--r--src/routes/(app)/pay/[username]/[...amount]/+page.svelte8
2 files changed, 5 insertions, 5 deletions
diff --git a/src/routes/(app)/pay/[username]/[...amount]/+page.server.ts b/src/routes/(app)/pay/[username]/[...amount]/+page.server.ts
index 23918cb3..f1e5a073 100644
--- a/src/routes/(app)/pay/[username]/[...amount]/+page.server.ts
+++ b/src/routes/(app)/pay/[username]/[...amount]/+page.server.ts
@@ -16,7 +16,7 @@ export async function load({ cookies, params, parent }) {
if (currency && !rate) error(500, "Invalid currency symbol");
if (amount) {
- if (currency) amount = (amount * sats) / rate;
+ if (currency) amount = String((Number(amount) * sats) / rate);
const { id } = await post(
"/invoice",
diff --git a/src/routes/(app)/pay/[username]/[...amount]/+page.svelte b/src/routes/(app)/pay/[username]/[...amount]/+page.svelte
index aa46cfd5..25e03e8f 100644
--- a/src/routes/(app)/pay/[username]/[...amount]/+page.svelte
+++ b/src/routes/(app)/pay/[username]/[...amount]/+page.svelte
@@ -18,10 +18,10 @@
let locale = $derived(loc(subject));
let next = $state();
- let initialAmount = $derived(form?.amount || data.amount);
+ let initialAmount = $derived((form as any)?.amount || data.amount);
let amount = $state();
let fiat = $state();
- let formElement = $state();
+ let formElement: HTMLFormElement | undefined = $state();
$effect(() => {
if (typeof amount === "undefined") amount = initialAmount;
@@ -31,10 +31,10 @@
let setMax = async (e) => {
e.preventDefault();
let body = new FormData(formElement);
- body.set("fiat", false);
+ body.set("fiat", String(false));
body.set("amount", user.balance);
- const response = await fetch(formElement.action, {
+ const response = await fetch(formElement!.action, {
method: "POST",
body,
});