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.svelte11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/routes/(app)/pay/[username]/[...amount]/+page.svelte b/src/routes/(app)/pay/[username]/[...amount]/+page.svelte
index 618504ca..82fa3750 100644
--- a/src/routes/(app)/pay/[username]/[...amount]/+page.svelte
+++ b/src/routes/(app)/pay/[username]/[...amount]/+page.svelte
@@ -12,14 +12,19 @@
let { subject, rate, user } = $state(data);
let currency = subject?.currency || "USD";
- let locale = $derived(loc(subject));
+ let locale = $derived(() => loc(subject));
let next = $state();
let initialAmount = $derived(form?.amount || data.amount);
- let amount = $state(initialAmount);
- let fiat = $state(!initialAmount);
+ let amount = $state();
+ let fiat = $state();
let formElement = $state();
+ $effect(() => {
+ if (typeof amount === "undefined") amount = initialAmount;
+ if (typeof fiat === "undefined") fiat = !initialAmount;
+ });
+
let setMax = async (e) => {
e.preventDefault();
let body = new FormData(formElement);