aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/invoice/+server.js
blob: 5b2f2b39497421305eda6e7b306ece41613e9687 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
import { auth, get, post } from '$lib/utils';

export async function POST({ cookies, request }) {
	let { amount, currency, network = 'lightning', prompt, rate, tip, user } = await request.json();
	let invoice = { amount, currency, network, prompt, rate, tip };

	return new Response(JSON.stringify(await post('/invoice', { invoice, user }, auth(cookies))), {
		headers: { 'content-type': 'application/json' }
	});
}