aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/invoice/+server.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2022-09-26 23:56:19 -0700
committerAdam Soltys <[email protected]>2022-09-26 23:56:49 -0700
commit66a6935a7050be9490780102bd80205f7c1ff6c3 (patch)
tree30102e141a37d75dbe60e5ee1d7ecbb1e4165b1d /src/routes/invoice/+server.js
parentbc8e1f7a365b16b7d5fe5a77fcc0754b13a40d0c (diff)
downloadcoinos-ui-66a6935a7050be9490780102bd80205f7c1ff6c3.tar.gz
coinos-ui-66a6935a7050be9490780102bd80205f7c1ff6c3.zip
tip refactoring
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' }
+ });
}