aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/invoice
diff options
context:
space:
mode:
authorsecondl1ght <[email protected]>2022-08-22 18:00:00 -0400
committersecondl1ght <[email protected]>2022-08-22 18:00:00 -0400
commit2aa7156e12200798c45a53878dbcc37c77625752 (patch)
tree85d0cb70ec847bb7df8ca08ee5f5328ebc2600f4 /src/routes/invoice
parentbc77cf10532a4060d97b0f804111b4f582151120 (diff)
downloadcoinos-ui-2aa7156e12200798c45a53878dbcc37c77625752.tar.gz
coinos-ui-2aa7156e12200798c45a53878dbcc37c77625752.zip
finish hooking up currency selection
Diffstat (limited to 'src/routes/invoice')
-rw-r--r--src/routes/invoice/+server.js3
-rw-r--r--src/routes/invoice/[id]/+page.svelte9
2 files changed, 6 insertions, 6 deletions
diff --git a/src/routes/invoice/+server.js b/src/routes/invoice/+server.js
index 24fffb21..c77784d7 100644
--- a/src/routes/invoice/+server.js
+++ b/src/routes/invoice/+server.js
@@ -1,5 +1,6 @@
import { json as json$1 } from '@sveltejs/kit';
import { post } from '$lib/utils';
+import { user } from '$lib/store';
let network = 'lightning';
@@ -7,7 +8,7 @@ export async function POST({ request }) {
let { amount, rate, username, text } = await request.json();
if (!text) ({ text } = await post('/lightning/invoice', { amount }));
let { uuid: id } = await post('/invoice', {
- invoice: { amount, currency: 'USD', network, rate, text },
+ invoice: { amount, currency: user.currency, network, rate, text },
user: { username }
});
diff --git a/src/routes/invoice/[id]/+page.svelte b/src/routes/invoice/[id]/+page.svelte
index d7824710..f42aba04 100644
--- a/src/routes/invoice/[id]/+page.svelte
+++ b/src/routes/invoice/[id]/+page.svelte
@@ -1,7 +1,7 @@
<script>
import { get, post, reverseFormat } from '$lib/utils';
import { browser } from '$app/env';
- import { invoices, user, preferredCurrency } from '$lib/store';
+ import { invoices, user } from '$lib/store';
import { Icon, Image } from '$comp';
import { goto } from '$app/navigation';
import { onMount } from 'svelte';
@@ -26,7 +26,7 @@
$: tipAmountFormatted = new Intl.NumberFormat('en-US', {
style: 'currency',
- currency: 'USD'
+ currency: $user.currency
}).format(tipAmount);
$: tipAmountSats = new Intl.NumberFormat('en-US', { maximumFractionDigits: 0 }).format(
@@ -50,7 +50,7 @@
$: totalAmountFormatted = new Intl.NumberFormat('en-US', {
style: 'currency',
- currency: 'USD'
+ currency: $user.currency
}).format(amountFiat + parseFloat(tipAmount));
const amountFormatted = new Intl.NumberFormat('en-US', {
@@ -59,7 +59,7 @@
$: invoiceAmountFiatFormatted = new Intl.NumberFormat('en-US', {
style: 'currency',
- currency: 'USD'
+ currency: $user.currency
}).format(amountFiat);
let customTipAmount;
@@ -296,7 +296,6 @@
<h1 class="text-3xl md:text-4xl font-bold mb-6">{$_('invoice.paymentSuccessful')}</h1>
<h2 class="text-2xl md:text-3xl font-semibold">
{totalAmountFormatted}
- {$preferredCurrency}
</h2>
<h3 class="text-secondary md:text-lg mb-6 mt-1">({totalAmountSats} SAT)</h3>
<button class="bg-black text-white rounded-2xl w-20 py-3 font-bold" on:click={handleDoneClick}>