diff options
Diffstat (limited to 'src/routes/(app)/send/invoice')
| -rw-r--r-- | src/routes/(app)/send/invoice/[id]/+page.server.js | 3 | ||||
| -rw-r--r-- | src/routes/(app)/send/invoice/[id]/+page.svelte | 6 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/routes/(app)/send/invoice/[id]/+page.server.js b/src/routes/(app)/send/invoice/[id]/+page.server.js index c9c2b222..50e72d94 100644 --- a/src/routes/(app)/send/invoice/[id]/+page.server.js +++ b/src/routes/(app)/send/invoice/[id]/+page.server.js @@ -7,6 +7,7 @@ export async function load({ params: { id }, parent, url }) { let { amount, address, + currency, hash, rate, prompt, @@ -17,7 +18,7 @@ export async function load({ params: { id }, parent, url }) { if (prompt && tip === null) throw redirect(307, `/${recipient.username}/invoice/${id}/tip`); if (recipient.username === user.username) throw error(500, { message: 'Cannot send to self' }); - return { amount, address, hash, tip, rate, payreq: text, recipient }; + return { amount, address, currency, hash, tip, rate, payreq: text, recipient }; } export const actions = { diff --git a/src/routes/(app)/send/invoice/[id]/+page.svelte b/src/routes/(app)/send/invoice/[id]/+page.svelte index c9cb9392..d2471891 100644 --- a/src/routes/(app)/send/invoice/[id]/+page.svelte +++ b/src/routes/(app)/send/invoice/[id]/+page.svelte @@ -9,8 +9,8 @@ export let data; export let form; - let { address, payreq, recipient, rate, tip, user } = data; - let { currency } = user; + let { address, rate, payreq, recipient, tip, rates, user } = data; + let { currency } = user; let amount = form?.amount || data.amount; let a, @@ -26,6 +26,8 @@ let loading; let submit = () => (loading = true); + $: rate = data.rate * (rates[user.currency] / rates[data.currency]); + $: update(form); let update = () => { if (form?.message.includes('pin')) $pin = undefined; |
