aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/invoice/+server.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes/invoice/+server.js')
-rw-r--r--src/routes/invoice/+server.js17
1 files changed, 4 insertions, 13 deletions
diff --git a/src/routes/invoice/+server.js b/src/routes/invoice/+server.js
index d9a9739c..759c9315 100644
--- a/src/routes/invoice/+server.js
+++ b/src/routes/invoice/+server.js
@@ -1,15 +1,7 @@
import { auth, get, post } from '$lib/utils';
export async function POST({ request, parent }) {
- let {
- amount,
- currency,
- network = 'lightning',
- prompt,
- rate,
- tip,
- username
- } = await request.json();
+ let { amount, currency, network = 'lightning', prompt, rate, tip, user } = await request.json();
let invoice = { amount, currency, network, prompt, rate, tip };
if (network === 'lightning') {
@@ -18,8 +10,7 @@ export async function POST({ request, parent }) {
invoice.address = (await get('/address?network=bitcoin&type=bech32')).address;
}
- return new Response(
- JSON.stringify(await post('/invoice', { invoice, user: { username } }, auth(request))),
- { headers: { 'content-type': 'application/json' } }
- );
+ return new Response(JSON.stringify(await post('/invoice', { invoice, user }, auth(request))), {
+ headers: { 'content-type': 'application/json' }
+ });
}