From 7bd39ca6f942c146a6e21be625c03bef84c1d3ee Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sun, 30 Oct 2022 22:11:10 -0700 Subject: revamped tip prompt --- src/lib/invoice.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/lib') diff --git a/src/lib/invoice.js b/src/lib/invoice.js index 1212cbe3..e8a5f615 100644 --- a/src/lib/invoice.js +++ b/src/lib/invoice.js @@ -11,12 +11,16 @@ export default async ({ cookies, request }) => { tip: parseInt(form.get('tip')), network: 'lightning', prompt: form.get('prompt') === 'true', - rate: rates[form.get('currency')] + rate: parseFloat(form.get('rate')) || rates[form.get('currency')] }; let user = { username: form.get('username') }; let { uuid } = await post('/invoice', { invoice, user }, auth(cookies)); - throw redirect(307, `/invoice/${uuid}`); + if (invoice.prompt) { + throw redirect(307, `/invoice/${uuid}/tip`); + } else { + throw redirect(307, `/invoice/${uuid}`); + } }; -- cgit v1.2.3