aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes/(app)')
-rw-r--r--src/routes/(app)/+layout.svelte1
-rw-r--r--src/routes/(app)/send/user/[username]/[...amount]/+page.server.js3
-rw-r--r--src/routes/(app)/send/user/[username]/[...amount]/+page.svelte10
3 files changed, 6 insertions, 8 deletions
diff --git a/src/routes/(app)/+layout.svelte b/src/routes/(app)/+layout.svelte
index 45469bdb..0dcdc1b2 100644
--- a/src/routes/(app)/+layout.svelte
+++ b/src/routes/(app)/+layout.svelte
@@ -25,7 +25,6 @@
};
$: $selectedRate = r * (rates[u?.currency || 'USD'] / rates.USD);
- $: $selectedRate = $rate * (rates[u?.currency || 'USD'] / rates.USD);
onMount(() => {
let localStorageLocale = localStorage.getItem(localeLocalStorageKey);
diff --git a/src/routes/(app)/send/user/[username]/[...amount]/+page.server.js b/src/routes/(app)/send/user/[username]/[...amount]/+page.server.js
index 18eda839..c63328e2 100644
--- a/src/routes/(app)/send/user/[username]/[...amount]/+page.server.js
+++ b/src/routes/(app)/send/user/[username]/[...amount]/+page.server.js
@@ -13,9 +13,6 @@ export const actions = {
default: async ({ cookies, request }) => {
try {
let body = await fd(request);
- let { amount } = body;
- amount = parseInt(amount);
-
await post('/payments', body, auth(cookies));
} catch (e) {
console.log(e);
diff --git a/src/routes/(app)/send/user/[username]/[...amount]/+page.svelte b/src/routes/(app)/send/user/[username]/[...amount]/+page.svelte
index 74da1fa8..1bb88277 100644
--- a/src/routes/(app)/send/user/[username]/[...amount]/+page.svelte
+++ b/src/routes/(app)/send/user/[username]/[...amount]/+page.svelte
@@ -17,14 +17,16 @@
let a,
af,
fiat = !amount,
- hash;
+ hash,
+ rate,
+ amountFiat = 0;
- $: amountFiat = amount * ($selectedRate / sats);
+ selectedRate.subscribe((r) => rate || (amountFiat = amount * (r / sats)));
let setAmount = async () => {
amount = a;
- amountFiat = af;
-
+ amountFiat = parseFloat(af).toFixed(2);
+ rate = fiat ? (sats * amountFiat) / amount : $selectedRate;
({ hash } = await post(`/${subject.username}/invoice`, {
invoice: {
amount,