aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/invoice/index.js
blob: f6b1f2cf2aa31479d70ee29569e317005f76354a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import { post } from '$lib/utils';

let network = 'lightning';

export async function POST({ request }) {
	let { amount, rate, username } = await request.json();
	let { text } = await post('/lightning/invoice');
	let { uuid: id } = await post('/invoice', {
		invoice: { amount, currency: 'USD', network, rate, text },
		user: { username }
	});

	return { body: { id } };
}