From 66a6935a7050be9490780102bd80205f7c1ff6c3 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 26 Sep 2022 23:56:19 -0700 Subject: tip refactoring --- src/routes/invoice/+server.js | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'src/routes/invoice/+server.js') 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' } + }); } -- cgit v1.2.3