From 866b78f25c9c8ae9c6cd3d0892aff3933cabf556 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 8 Feb 2023 13:20:22 -0800 Subject: internal payment fixes --- src/routes/(app)/send/[...text]/+page.server.js | 15 ++++++--------- src/routes/(app)/send/[...text]/+page.svelte | 9 +++++++-- src/routes/(app)/send/invoice/[id]/+page.server.js | 4 +++- 3 files changed, 16 insertions(+), 12 deletions(-) (limited to 'src/routes/(app)/send') diff --git a/src/routes/(app)/send/[...text]/+page.server.js b/src/routes/(app)/send/[...text]/+page.server.js index 4c2776f5..d09b4da9 100644 --- a/src/routes/(app)/send/[...text]/+page.server.js +++ b/src/routes/(app)/send/[...text]/+page.server.js @@ -63,24 +63,21 @@ let parse = async (t, host) => { if (user) throw redirect(307, `/send/user/${t}`); - // pot + // pot let pot; try { pot = await get(`/pot/${t}`); - console.log(pot); - } catch (e) { - } + } catch (e) {} if (pot) throw redirect(307, `/send/pot/${t}`); - // invoice - let invoice; + // invoice + let invoice; try { invoice = await get(`/invoice/${t}`); - } catch (e) { - } + } catch (e) {} - if (invoice) throw redirect(307, `/send/invoice/${invoice.hash}`); + if (invoice) throw redirect(307, `/send/invoice/${invoice.hash}`); }; export async function load({ cookies, params, request, url }) { diff --git a/src/routes/(app)/send/[...text]/+page.svelte b/src/routes/(app)/send/[...text]/+page.svelte index 2a9df12a..5a376f9f 100644 --- a/src/routes/(app)/send/[...text]/+page.svelte +++ b/src/routes/(app)/send/[...text]/+page.svelte @@ -38,9 +38,14 @@
{#if form?.error}
-
Could not find anything with that name. Would you like to create a new pot?
+
+ Could not find anything with that name. Would you like to create a new pot? +
- +
{/if} diff --git a/src/routes/(app)/send/invoice/[id]/+page.server.js b/src/routes/(app)/send/invoice/[id]/+page.server.js index 6b7823ce..2df19985 100644 --- a/src/routes/(app)/send/invoice/[id]/+page.server.js +++ b/src/routes/(app)/send/invoice/[id]/+page.server.js @@ -11,10 +11,12 @@ export async function load({ params: { id }, parent }) { } export const actions = { - default: async ({ cookies, request }) => { + default: async ({ cookies, params: { hash }, request }) => { try { let body = Object.fromEntries(await request.formData()); let { confirmed } = body; + body.amount = parseInt(body.amount); + body.hash = hash; if (!confirmed) { return fail(400, { amount, confirm: true }); -- cgit v1.2.3