diff options
Diffstat (limited to 'src/routes/(app)/send/user')
| -rw-r--r-- | src/routes/(app)/send/user/[username]/[...amount]/+page.server.js | 3 | ||||
| -rw-r--r-- | src/routes/(app)/send/user/[username]/[...amount]/+page.svelte | 10 |
2 files changed, 6 insertions, 7 deletions
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, |
